Skip to content
We areTOP 1%

What are DDL, DML, DCL and TCL commands?

EasyConceptDBMS Fundamentals
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

SQL commands are grouped into four families according to what they act on: the structure, the data, the permissions or the transactions.

  • DDL (Data Definition Language) defines or changes structure: CREATE, ALTER, DROP, TRUNCATE, RENAME.
  • DML (Data Manipulation Language) works with the rows inside tables: INSERT, UPDATE, DELETE and SELECT. Some books put SELECT in a separate DQL (Data Query Language) group.
  • DCL (Data Control Language) manages permissions: GRANT, REVOKE.
  • TCL (Transaction Control Language) manages transactions: COMMIT, ROLLBACK, SAVEPOINT.

In MySQL and Oracle, a DDL statement commits the current transaction automatically, so it cannot be rolled back. PostgreSQL can roll back most DDL inside a transaction.

Example:

CREATE TABLE marks (roll INT, score INT);   -- DDL
INSERT INTO marks VALUES (1, 85);           -- DML
GRANT SELECT ON marks TO teacher;           -- DCL
COMMIT;                                     -- TCL

More in DBMS Fundamentals

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account