DML (Data Manipulation Language) is the subset of SQL used to work with the data inside the structures that DDL defines. Almost all day-to-day SQL is DML. The keywords are:
- SELECT — retrieve rows from one or more tables. See SELECT statement.
- INSERT — add new rows.
- UPDATE — modify existing rows.
- DELETE — remove specific rows.
A new row is inserted with the column names and values explicit:
INSERT INTO students
(student_id, first_name, family_name, student_status,
phone, major_code, supervisor_code)
VALUES
(20201456, 'Mike', 'Smith', 'P', '+1 343 333', 10, 14);Naming the columns is wordier than INSERT INTO students VALUES (...) (which assumes all columns in declared order), but it’s robust to schema changes — adding a column later doesn’t break this statement.
Existing rows are modified with UPDATE ... SET ... WHERE ...:
UPDATE students
SET phone = '+1 343 444'
WHERE student_id = 20201456;The WHERE clause is essential — UPDATE students SET phone = '...' without it would set every student’s phone number to the same value.
Rows are removed with DELETE FROM ... WHERE ..., also with the WHERE clause as the load-bearing piece. DELETE FROM students with no WHERE empties the entire table, which is sometimes what you want and usually isn’t.
For aggregating, joining, and shaping queries — JOIN, GROUP BY, HAVING, ORDER BY, LIMIT — see the SELECT statement note. The other three SQL sub-languages are DDL for structure, DCL for permissions, and TCL for transactions.