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

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

SQL Overview

SQL (Structured Query Language), We can use this language to create database.
SQL contains commands like CREATE,DROP,INSERT, etc. to carry out required tasks

SQL Commands are categorized into five types.

  1. DDL – Data definition Language
  2. DQL – Data Query Language.
  3. DML – Data Manipulation Language.
  4. DCL – Data Control Language.
  5. TCL – Transaction Control Language.

DDL (Data Definition Language)

List of DDL Commands

  • CREATE – the Command is used to create the database or its objects like (table, index, function, views, stored procedure, and triggers)
  • DROP – This command is used to delete objects from the database.
  • ALTER – This is used to alter the structure of the database.
  • TRUNCATE – This is used to remove all recors from the table, includeing all spaces allocated for the recors are removed.
  • COMMENT: This is used to add comments to the data dictionary.
  • RENAME: This is used to rename an object existing in the database.

DQL (Data Query Language)

List of DQL Commands

  • SELECT : It is used to retrieve data from the database.

DML(Data Manipulation Language)

Deals with manipulation of data present in the database

List of DML commands:

  • INSERT: It is used to insert data into a table.
  • UPDATE: It is used to update existing data within a table.
  • DELETE: It is used to delete records from a database table.
  • LOCK: Table control concurrency.
  • CALL: Call a PL/SQL or JAVA subprogram.
  • EXPLAIN PLAN: It describes the access path to data.

DCL (Data Control Language)

DCL includes commands such as GRANT and REVOKE which mainly deal with the rights, permissions, and other controls of the database system.

List of DCL commands:

  • GRANT: This command gives users access privileges to the database.
  • REVOKE: This command withdraws the user’s access privileges given by using the GRANT command.

TCL (Transaction Control Language)

List of TCL Commands:

  • BEGIN: Opens a Transaction.
  • COMMIT: Commits a Transaction.
  • ROLLBACK: Rollbacks a transaction in case of any error occurs
  • SAVEPOINT: Sets a save point within a transaction.

Discover more from Coursity

Subscribe to get the latest posts to your email.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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