SQL DML, DDL, DCL, and TCL Commands

What are SQL DML, DDL, DCL, and TCL Commands, and their abbreviations are the most common question you might face in interviews.

The Structured Query Language is all about executing certain commands against the database or creating it. In SQL Server, all these commands are categorically organized into four categories and they are DML, DDL, DCL, and TCL Commands.

SQL DDL Commands

DDL means Data Definition Language. The Sql Server DDL commands are used to create and modify the structure of a database and database objects.

Examples of DDL commands are

The following are examples of the DDL commands

  1. CREATE – Create an object. I mean, create a database, tabletriggers, index, functionsstored procedures, etc.
  2. DROP – This DDL command helps to delete objects. For example, delete tables, delete a database, etc.
  3. ALTER – Used to alter the existing database or its object structures.
  4. TRUNCATE – This SQL DDL command removes records from tables
  5. RENAME – Renaming the database objects

SQL Server DML Commands

DML means Data Manipulation Language. As its name suggests, these Sql Server DML commands will perform data manipulation and manipulate data presented in the server).

Examples of DML commands are

  1. SELECT – This DML command selects records or data from a table
  2. INSERT – Insert data into a database table.
  3. UPDATE – This DML command will update existing records within a table
  4. DELETE – Delete unwanted records from a table

SQL Server DCL Commands

The SQL Server DCL means Data Control Language, and these DCL commands will control the Data access permission. 

DCL commands Examples are

  • GRANT – It permits users to access the database.
  • REVOKE – This DCL command withdraws the permission given by GRANT to access the database.

SQL Server TCL Commands

TCL means Transaction Control Language. These SQL Server TCL commands will control the Transactions.

Examples of TCL commands are

  • COMMIT –  This TCL command will commit the running transaction
  • ROLLBACK – Rollback the current transaction 
  • SAVEPOINT – You can set a save point so that next time, it will start from here
  • SET TRANSACTION – Specify the characteristics of the transactions