What are DDL, DML, DQL, DCL and TCL

The SQL commands are categorized into the following categories:

  • DDL - Data Definition Language
  • DML - Data Manipulation Language
  • DQL - Data Query Language
  • DCL - Data Control Language
  • TCL - Transaction Control Language

Let's see each of them in detail.

DDL

  • Queries like - CREATE, DROP, TRUNCATE, and ALTER fall into this category because they all manage the structure of DB Objects in some way.
  • For eg: CREATE command creates the structure of a table, DROP command removes the table structure.

DML

  • Queries like DELETE, UPDATE and INSERT fall into this category because they all manipulate the data in some way.
  • For eg: the DELETE command removes data in a table, UPDATE command updates the data.

DQL

  • The SELECT query falls into this category because it is used to query the database and get the output of the query.
  • For eg: Using SELECT, we can ask any specific question to a DB and get answers.

DCL

  • Queries like GRANT, and REVOKE fall into this category because they're used to control access to the DB.
  • For eg: GRANT will assign permission to a user on a DB Object and REVOKE will remove the permission.

TCL

  • Queries like ROLLBACK, COMMIT & SAVE POINT fall into this category as they're used to manage transactions in the database.
  • For eg: the COMMIT command commits the transaction and the ROLLBACK command rollback all changes done to a DB when a transaction fails.
Next Recommended Reading Single Stored Procedure For DML Queries