What are the types of SQL commands – Complete

What are the different types of commands in SQL, divided based on the type of operation they perform with simple explanation.

There are five types of commands in SQL based on the type of operation they perform.

DDL or Data Definition Language

Used in defining or manipulating database schema. These are used for creating, modifying, and dropping the structure of database objects such as tables.

ALTER TABLE <table_name>
DROP TABLE | DATABASE <object_name>

DML or Data Modification Language

Used in creating, updating or deleting data from the database objects such as tables.

INSERT INTO TABLE <table_name>
UPDATE <table_name> SET <column_name>=<new_value>
DELETE [ <column_name> | * ] FROM <table_name>

DCL or Data Control Language

Used enforce access control to data within the database or database objects.

GRANT <previlige_name> ON <object_name> TO <user_name>
REVOKE <previlige_name> ON <object_name> FROM <user_name>

TCL or Transaction Control Language

Used to enforce control on transactions within a database object which might result in a change in the state of data within the database objects.

ROLLBACK [ TO save_point_name ]
SAVEPOINT save_point_name

DQL or Data Query Language

Used for querying data from database objects. SELECT query is the only single command which can result in records from Database Objects such as tables, views etc and can be subject to projection.

The following table represents the command types and the SQL commands –

Command TypeSQL Commands
Data Definition LanguageCREATE, ALTER, DROP
Data Modification LanguageINSERT, UPDATE, DELETE
Data Control LanguageGRANT, REVOKE
Transaction Control LanguageCOMMIT, ROLLBACK, SAVEPOINT
Data Query LanguageSELECT

Buy Me A Coffee

Found this article helpful? Please consider supporting!


I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity. You can connect with me on Medium, Twitter or LinkedIn.

Leave a Reply

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