Home » SQL: DDL, DQL, DML, DCL, and TCL Commands

SQL: DDL, DQL, DML, DCL, and TCL Commands

  • by

SQL stands for Structural Query Language. SQL language we use for the different database-related operations. Using this language we can create a new database or modify the existing Database. SQL contains commands like DDL, DQL, DML, DCL, and TCL.

In this article, we are going to check more details about these commands.

SQL Commands are following

  1. Data Defination Langauge (DDL)
  2. Data Query Langauge (DQL)
  3. Data Manupulation Language (DML)
  4. Data Control Language (DCL)
  5. Transaction Control Language (TCL)

Data Defination Langauge(DDL):

DDL consist of SQL commands that are used to define the database schema, structure of the data stored in tables. DDL is again divided into categories.

  1. CREATE : Used to create the objects like Table, functions, stored procedure etc
  2. ALTER: Used to modify the structure of the existing tables
  3. DROP: Used to delete objects from database
  4. TRUNCATE: Used to removed the records from table and it retains the identity
  5. COMMENT: Used to add the comments
  6. RENAME: Used to rename the existing objects

Data Query Langauge(DQL)

DQL is used the perform the query operation on the database within the schema.

SELECT: is used to fetch the records from objects example- tables

Data Manupulation Language(DML)

DML is used for the manipulation of data that is present in the database. It is responsible for all forms of changes in the database.

  1. INSERT: SQL statement is use for to insert the record into table
  2. UPDATE: Is used to update the table rows or table records.
  3. DELETE: Statement is use for to delete the records from table.

Data Control Language(DCL)

DCL commands are used for permission and access-related operation. If we want to work with access-related stuff then we need to use DCL commands. DCL commands having two categories

  1. GRANT: Giving user access permisson to the database.
  2. REVOKE: Withdraw or take back the permission from the user so user can’t access the perticular database.

Transaction Control Language(TCL)

TCL is used to manage the transaction in the database. TCL can only use with DML commands(Insert, Update, Delete) only.

  1. COMMIT: Commit the transaction, It saves the transaction in the database.
  2. ROLLBACK: Undo the transaction, not saved in database
  3. SAVEPOINT: Point in transaction in which we can roll back the transaction to a certain point instead of entire transaction.

Need help?

Read this post again, if you have any confusion or else add your questions in Community