Vikas Rajput
Vikas Rajput

@vikasrajputin

9 Tweets 5 reads Nov 02, 2022
SQL: What are DDL, DML, DQL, DCL and TCL? ๐Ÿงต๐Ÿ‘‡
1. Introduction
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.
2. 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.
3. 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.
4. 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.
5. 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.
6. 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.
That's a wrap!
If you've loved reading this, then you might also like my previous thread on SQL Indexing:
I help people get started with Backend Development.
Follow me @vikasrajputin for more.
If you find this thread helpful then Like/Retweet the first tweet below:

Loading suggestions...