0% found this document useful (0 votes)
2 views2 pages

DML_Commands_SQL

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

DML_Commands_SQL

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

DML (Data Manipulation Language) Commands in SQL

DML commands database ke andar data ko insert, update, delete karne ke liye use hote hain.

1) INSERT (Naya data add karna)


-------------------------------
INSERT INTO employees (id, name, salary, department)
VALUES (1, 'Ashutosh', 50000, 'IT');

Multiple rows insert karne ke liye:


INSERT INTO employees (id, name, salary, department)
VALUES
(2, 'Rohit', 60000, 'HR'),
(3, 'Gagan', 55000, 'Finance');

2) UPDATE (Data ko modify karna)


--------------------------------
UPDATE employees
SET salary = 55000
WHERE id = 1;

Multiple fields update karne ke liye:


UPDATE employees
SET salary = 70000, department = 'Marketing'
WHERE id = 2;

Important: Agar WHERE condition nahi likhi, toh poora table update ho jayega!

3) DELETE (Data ko remove karna)


--------------------------------
DELETE FROM employees
WHERE id = 3;

Agar sabhi records delete karne hain:


DELETE FROM employees;

Important: Agar WHERE condition nahi likhi, toh poora table empty ho jayega!
4) SELECT (Data ko retrieve karna)
----------------------------------
SELECT * FROM employees;

Kisi specific employee ka data dekhne ke liye:


SELECT name, salary FROM employees WHERE department = 'IT';

DML Commands Summary:


---------------------
| Command | Purpose |
|----------|----------------------------------|
| INSERT | Table me naye records add karne ke liye |
| UPDATE | Existing records modify karne ke liye |
| DELETE | Records ko remove karne ke liye |
| SELECT | Data ko retrieve karne ke liye |

You might also like