Responsive Advertisement

SQL Command types

SQL Command types

Structured Query Language (SQL), as we are all aware, is a database language that allows us to conduct certain operations on an already-existing database as well as utilize it to construct new databases. For the necessary actions, SQL requires specific commands like Create, Drop, Insert, etc.

The sql command are mainly categorized into five categories such as:

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

DDL – Data Definition Language

DDL or Data Definition Language can be used to define the database schema such as use to create modify the database.

  • CREATE: is used to create the database or its objects like table, index, function, views, store, procedure, and triggers.
  • DROP: is used to delete objects from database.
  • ALTER: is used to alter the structure of the database.
  • TRUNCATE: is used to remove all records from a table, including all spaces allocated for the records are removed.
  • COMMENT: is used to add comments to the data dictionary.
  • RENAME: is used to rename an object existing in the databases.

DML – Data Manipulation Language

DML or Data Manipulation Language is the component of the SQL statement that can controls access to data and to the database.

  • 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 or Data Control Language commands such as GRANT and REVOKE which mainly work with the rights, permission, and other controls of the database system.

  • GRANT: gives users access priviliges to the database.
  • REVOKE: withdraws the user's access priviliges given by using the GRANT command.

TCL – Transaction Control Language

  • COMMIT: Commit a Transaction
  • ROLLBACK: Rollbacks a transaction in case of any error occurse
  • SAVEPOINT: Sets a savepoint within a transaction
  • SET TRANSACTION: Specify characteristics for the transaction

DQl – Data Query Language

DQL Data Query Language is use to retreive data from the database.

  • SELECT: Select data from database.

Post a Comment

0 Comments