What are SQL DML, DDL, DCL, and TCL Commands, and their abbreviations is the most common common question you might face in Sql interviews.
SQL DDL Commands
In SQL, DDL means Data Definition Language. DDL commands are used to create and modify the structure of a database and database objects.
Examples of DDL commands in SQL Server are
- CREATE – Create a object. I mean, create a database, table, triggers, index, functions, stored procedures etc.
- DROP – Helps to delete objects. For example, delete table, delete database etc.
- ALTER – Used to alter the existing database or its objects structures.
- TRUNCATE – Removes records from tables
- RENAME – Renaming the database objects
SQL DML Commands
DML means Data Manuplation Language. As it’s name suggests, theses commands will perform data manipulation manipulate data presented in server).
Examples of DML commands in SQL Server are
- SELECT – Select records or data from a table
- INSERT – Insert data into a database table.
- UPDATE – Update existing records within a table
- DELETE – Delete unwanted records from a table
SQL DCL Commands
DCL means Data Control Language. These commands will control the Data access permission.
Examples of DCL commands in SQL Server are
- GRANT – It gives users permision o access database.
- REVOKE – This command will withdraw the permission given by GRANT to access database.
SQL TCL Commands
TCL means Transaction Control Language. These commands will control the Transactions.
Examples of TCL commands in SQL Server are
- COMMIT – This 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 transactions characteristics