SQL Commands
- SQL commands are instruction which is used to communicate with the database.
- It is also used to perform specific tasks, functions, and queries of data
- It can also perform various tasks like creating a table, updating a table, deleting a table etc.
Types of SQL Commands
There are 5 types of SQL Commands
DDL (Data Definition Language)
- Changing the structure of table like creating table, altering a table, and deleting a table can be done using this DDL
- Commands in ddl are autocommitted which means it permanently save all changes in the database.
- Some of the command in DDL are: create, alter,drop, truncate.
DML – Data Manipulation Language
- These commands are used for modifing the database. Responsible for all form of changes in the database.
- Commands in dml are not autocommitted which means it cannot permanently save all changes in the database. They can roll back.
- Some of the commands under DML are:
- Insert, Update, Delete.
DCL – Data Control Language
- These command are used to grant and revoke authorities from user.
- Some of the commands under DCL are:
- Grant
- Revoke
TCL – Transaction Control Language
- These commands can only be used with DML commands like Insert, delete, update etc.
- These operations are auto committed that is why they cannot be used while creating tables or dropping them.
- Some of the commands under TCL are:
- Commit
- Roll Back
- Save Point
DQL – Data Query Language
- These commands are used to fetch the data from a database.
- Select is the only command used in this language.