DML Commands
DML (Data Manipulation Language) commands in SQL/MySQL are used for managing and manipulating data within relational databases.
The main DML commands are:
- INSERT INTO
- UPDATE
- DELETE
INSERT INTO
This command is used to insert new records in a table.
- When Specify both the column names and the values:
INSERT INTO table_name (column1,column2,column3, ...) VALUES (value1, value2, value3, ...);- When adding the values into all columns:
INSERT INTO table_name VALUES (value1, value2, value3, ...);UPDATE
Used to modify the existing records in a table.
UPDATE table_name SET column1 = value1, WHERE condition; UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;DELETE
The DELETE statement is used to delete existing records in a table.
DELETE FROM table_name WHERE condition;