What are the four categories of SQL commands — DDL, DML, DCL and TCL — and what does each one actually touch?
They are four buckets that split the SQL grammar by what the statement changes and, crucially, by what the engine does when it fails.
DDL — Data Definition Language. Changes the shape of the database: CREATE, ALTER, DROP, TRUNCATE, CREATE INDEX, This is the category that shows up in a migration file and the one most likely to lock a table.CREATE VIEW. It edits the schema, not the rows.
DML — Data Manipulation Language. Changes the rows: SELECT, INSERT, UPDATE, DELETE, and the MERGE family. It is the bucket your application spends all day inside, and the one covered by transaction semantics.
DCL — Data Control Language. Changes who is allowed to do what: GRANT, REVOKE, CREATE USER, CREATE ROLE. In managed cloud databases this is often replaced by an external identity provider, but the concept stays.
TCL — Transaction Control Language. Controls transaction boundaries: BEGIN/START TRANSACTION, COMMIT, ROLLBACK, SAVEPOINT. It does not change data on its own; it decides whether the DML inside it survives.
The reason interviewers care about the split is operational. DML is usually rollback-able and transaction-safe; DDL in some engines forces an implicit commit and is not. That single fact decides whether a schema migration can be made atomically.