Types of SQL Commands

Different Types of SQL Commands

In total there are five types of SQL Statements:

  1. DDL: Data Definition Language
  2. DML: Data Manipulation Language
  3. DQL: Data Query Language
  4. DCL: Data Control Language
  5. TCL: Transaction Control Language
sql types of commands

1. DDL statement

DDL statement stands for Data Definition Language. This is used to define the schema and structure of a Database. These statements include:

  1. CREATE: This is used to create the table in a database. To know more about CREATE Click here.
  2. DROP: This is used to drop the entire schema in a database. To know more about DROP Click here.
  3. TRUNCATE: This is used to delete the values in a table at a single go. 
  4. ALTER: This is used to alter values in a table. To know more about ALTER, Click here.

Also, you can refer here to know the difference between Delete, Drop and Truncate statement.

NOTE: DDL statements are automatically committed in a database. 

2. DML Statement

DML Statement stands for Data Manipulation Language. The statements are not auto-committed in a Database, we need to save changes done by DML statements in a database. This includes:

  1. INSERT: insert values in the database. Click here to learn more about it.
  2. UPDATE: Update the values.
  3. DELETE: This is used to delete values present in the Table. Click this link to get updated about DELETE.

3. DQL Statement

DQL statement stands for Data Query Language. This is used for performing queries on the data present in the database. This includes the SELECT Statement. To learn about SELECT, Click here.

4. DCL Statement

DCL stands for Data Control Languages. This is used to control permissions or privileges on the different users of the database. This includes:

  1. GRANT: This is used to Grant privileges to different users. To learn in details about GRANT, click here.
  2. REVOKE: This is used to Revoke privileges from different users. To learn in details about REVOKE, click here.

5. TCL Statement

Transaction Control Statement is used to control the transactions in the database. It includes:

  1. COMMIT: Used to save changes in the database. Click here, to learn more about COMMIT.
  2. ROLLBACK: This Rollback the changes are done in the database. To learn about ROLLBACK, click here
  3. SAVEPOINT: This is used to save partial changes in the database.