Different Types of SQL Commands
In total there are five types of SQL Statements:
- DDL: Data Definition Language
- DML: Data Manipulation Language
- DQL: Data Query Language
- DCL: Data Control Language
- TCL: Transaction Control Language
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:
- CREATE: This is used to create the table in a database. To know more about CREATE Click here.
- DROP: This is used to drop the entire schema in a database. To know more about DROP Click here.
- TRUNCATE: This is used to delete the values in a table at a single go.
- 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:
- INSERT: insert values in the database. Click here to learn more about it.
- UPDATE: Update the values.
- 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:
- GRANT: This is used to Grant privileges to different users. To learn in details about GRANT, click here.
- 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: