SQL DDL,DML,DCL,TCL COMMANDS – Free SQL Tutorial

SQL is a database language that has commands to create, manipulate etc the database. All the commands can be broadly classified into following categories:

  1. DDL Commands
  2. DML Commands
  3. DCL Commands
  4. TCL Commands

DDL(Data Definition Language) Commands:

Data Definition Language commands in SQL are used to define the database schema. These commands deal with description of database schema and is also used to modify the structure of database objects

Examples of DDL Commands:

  • CREATE – Create command is used to create the database or objects like View, Function, Procedures etc.
  • DROP –  DROP command is used to delete objects from the database.
  • ALTERALTER command is used to alter the structure of the database.
  • TRUNCATETRUNCATE command is used to remove records from table along with their memory spaces.
  • COMMENTSCOMMENTS command is used to add comments to data dictionary.
  • RENAMERENAME command is used to rename the object in the database.

DML(Data Manipulation Language) Commands:

Data Manipulation Commands are used to manipulate the data present in the database.

Example of DML Commands:

  • SELECT – SELECT command is used to retrieve data from database.
  • INSERTINSERT command is used to insert data in a table.
  • UPDATEUPDATE command is used to change data in a table.
  • DELETEDELETE command is useful in deleting records from table in database.

DCL(Data Control Language) Commands:

Data Control Language Commands deals with rights, permissions, controls of a database system

Example of DCL Commands:

  • GRANT – GRANT command gives user access privileges to database.
  • REVOKEREVOKE command withdraw user access privileges given using GRANT command.

TCL(Transaction Control Language) Commands:

Transaction Control Language Commands are used to deal with transactions in the database

Example of TCL Commands:

  • COMMIT – COMMIT command commits a transaction.
  • ROLLBACKROLLBACK command rollbacks a transaction if any error occurs.
  • SAVEPOINTSAVEPOINT command sets a Save point in the transaction.
  • SET TRANSACTIONSET TRANSACTION command is used to specify characteristics for the transaction.

 

Leave a Comment

Your email address will not be published. Required fields are marked *