top of page

SQL Commands

SQL can perform wide range of operations using its commands such as INSERT, UPDATE,

DELETE, and lot more. The commands are classified to groups according to their usage.

Types of SQL Commands

  1. Data Definition Language (DDL)

  2. Data Manipulation Language (DML)

  3. Data Control Language (DCL)

  4. Transaction Control Language (TCL)

1. Data Definition Language (DDL)

Data definition language is use to create or define a new data or table in a database. we can also redefine or rename and modify a new data using DDL commands.

Title
Explanation
Create
Create Command is use to create a new table or database for the first time.
Alter
Alter is use to change and modify the existing table or column with new features.
Drop
Drop is use to drop and delete an entire table or database along with his structure and you can't rollback to previous state once you drop the table. It is slower than Truncate.
Rename
Rename is use to rename the table, objects or database.
Truncate
Truncate works similar to drop command with only difference is that the structure of the table is not deleted only the values are deleted and it is faster than drop statement.

2. Data Manipulation Language (DML)

Data manipulation language is use to manipulate and make changes in a existing data.

Title
Explanation
Select
Select command is use to fetch and retrieve the desired records from the table. It is going to be most frequently used command in our course.
Insert
Insert command is use to insert the new values to an existing tables.
Update
Update is use to modify and update the existing records.
Delete
Delete is use to delete a specific record or a complete record. The main difference between delete and truncate is that in delete we can use the where clause to specify the condition.

3. Data Control Language (DCL)

Data control language is use to grant and revoke permissions from users to access and manipulate database.

Command
Explanation
GRANT
Grant is use to grant a new access permission to a user.
REVOKE
revoke is use to revoke the permissions user already have.

4. Transaction Control Language (TCL)

Transaction control language is use to save the changes permanently to the database or undo the changes.

Command
Explanation
COMMIT
It is use to make the changes permanently saved to the database.
ROLLBACK
It helps us to do undo the changes we made. It is advisable to use the rollback command carefully because it will take us to the last uncommited state.
bottom of page