Introduction

SQL’s complete form is “Structured Query Language“. This is a language that allows you to access and manipulate the database.

Types Of SQL Commands?

There are mainly 5 types of SQL commands:

1. DDL

DDL stands for Data Definition Language. In short words, DDL is used to create and modify the database permanently. So we can say that these are auto-committed.

Some important DDL commands are:

Create: Uses for creating data tables.

Drop: Uses for deleting the data tables and databases.

Alter: Uses for modifying (add, rename or modify) data tables.

Truncate: Uses for deleting data tables.

2. DML

DML stands for Data Manipulation Language. In short words, DML is used to insert, update and delete the data tables of databases.

Note: DML commands are not auto-committed. We can roll back DML commands.

Important DML commands are:

Insert: insert the records in the data table.

Update: update the records in the data table.

Delete: delete the records in the data table.

3. DCL

DCL stands for Data Control Language. DCL provides two main commands Grant and Revoke for access to the database user. Grant is used for giving privileges to the database user and Revoke is used for taking back privileges from the database user.

4. DQL

DQL stands for Data Query Language. If you want to fetch the records from the data tables of any database you should use DQL.

The SELECT command is used to fetch the records from the table. we can use different conditions for fetching the records from the table with the select command.

5. TCL

TCL stands for Transition Control Language. As I described in DML commands that they are auto-committed. So, Here we need TCL commands these only work on DML commands(Insert, Update and Delete).

Some important TCL Commands are as follows:

COMMIT: save all the transitions in the database.

ROLLBACK: undo all the transitions that have not already been saved in the database.

Read Also: All important SQL commands in short