What are SQL DML, DDL, DCL, and TCL Commands, and their abbreviations are the most common question you might face in SQL interviews.
SQL DDL Commands
In SQL, 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 Sql Server DDL commands are
- CREATE – Create an object. I mean, create a database, table, triggers, index, functions, stored procedures, etc.
- DROP – This SQL DDL command helps to delete objects. For example, delete tables, delete a database, etc.
- ALTER – Used to alter the existing database or its object structures.
- TRUNCATE – This SQL DDL command removes records from tables
- RENAME – Renaming the database objects
SQL DML Commands
DML means Data Manipulation Language in Sql Server. As its name suggests, these Sql Server DML commands will perform data manipulation manipulate data presented in the server).
Examples of DML commands in SQL Server are
- SELECT – This SQL DML command select records or data from a table
- INSERT – Insert data into a database table.
- UPDATE – This SQL DML command will update existing records within a table
- DELETE – Delete unwanted records from a table
SQL DCL Commands
The Sql Server DCL means Data Control Language. These DCL commands in SQL Server will control the Data access permission.
Sql Server DCL commands Examples are
- GRANT – It permits users to access the database.
- REVOKE – This SQL DCL command withdraws the permission given by GRANT to access the database.
SQL TCL Commands
Examples of TCL commands in SQL Server are
- COMMIT – This SQL 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