Data Manipulation Language (DML) is used to manage and manipulate data inside database tables. It allows users to insert, update, delete, and retrieve data.
1. INSERT
The INSERT command is used to add new records into a table.
Example:
INSERT INTO Students (ID, Name, Age) VALUES (1, 'Ravi', 21);
This adds a new row into the Students table.
2. UPDATE
The UPDATE command is used to modify existing data in a table.
Example:
UPDATE Students SET Age = 22 WHERE ID = 1;
This updates the age of the student with ID 1.
3. DELETE
The DELETE command is used to remove records from a table.
Example:
DELETE FROM Students WHERE ID = 1;
This deletes the record where ID is 1.
4. SELECT
The SELECT command is used to retrieve data from a table.
Example:
SELECT * FROM Students;
This displays all records from the Students table.
5. Key Points
- DML works with data, not structure
- Changes can be controlled using transactions
- Commands affect rows in a table
- Widely used in real-world applications
Conclusion
DML is used to manage data inside tables. It helps in adding, updating, deleting, and retrieving data efficiently.
Your learning journey continues 🚀
