What Is DDL, DML, DQL, DCL and TCL

The SQL commands are divided into the following groups:

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

Let’s take a closer look at each of them.

DDL

  • This category includes queries like CREATE, DROP, TRUNCATE, and ALTER since they all manage the structure of DB Objects in some way.
  • For example, the CREATE command constructs the structure of a table, but the DROP command deletes the table structure.

DML

  • This category includes queries like DELETE, UPDATE, and INSERT since they all alter data in some way.
  • For example, the DELETE command deletes data from a table, but the UPDATE command modifies the data.

DQL

  • This category includes the SELECT query, used to query the database and obtain the query’s result.
  • For example, we may use SELECT to ask a database any specified question and retrieve replies.

DCL

  • GRANT and REVOKE queries come under this category since they are used to control access to the database.
  • Provide, for example, will grant permission to a user on a DB Object, whereas REVOKE will revoke the access.

TCL

  • Queries like ROLLBACK, COMMIT and SAVE POINT come under this category since they are used to control database transactions.
  • For example, when a transaction fails, the COMMIT command commits the transaction, and the ROLLBACK command rolls back all changes made to the database.

 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories