Skip to main content

What are DDL, DML, DCL, TCL?

These are classes of SQL commands that group database operations by purpose:

1. DDL (Data Definition Language)

Used to create and change the database's structure. Example commands:

  • CREATE TABLE, create a table
  • ALTER TABLE, change a table (add a column, change a data type)
  • DROP TABLE, delete a table

The gist: manages structure, not data.

2. DML (Data Manipulation Language)

Used to add, change, delete, and retrieve data. Example commands:

  • SELECT, retrieve data
  • INSERT, insert a new record
  • UPDATE, change an existing record
  • DELETE, delete a record

The gist: works with the actual data inside tables.

3. DCL (Data Control Language)

Used to manage user rights and security. Example commands:

  • GRANT, give a user rights
  • REVOKE, take rights away

The gist: controls who's allowed to do what in the database.

4. TCL (Transaction Control Language)

Used to manage the logic of running groups of operations (transactions). Example commands:

  • COMMIT, confirm changes
  • ROLLBACK, undo changes
  • SAVEPOINT, create a save point inside a transaction

The gist: ensures data integrity when several operations run at once.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.