Types of SQL Commands
SQL commands are instructions used to communicate with a database to perform specific tasks, work, functions, or queries with data. SQL commands can be classified into several categories including:
DDL (Data Definition Language)
These commands are used to define the structure that holds the data.
For example, CREATE
, ALTER
, DROP
, TRUNCATE
, and RENAME
commands.
DML (Data Manipulation Language)
These commands are used for managing data present in the database.
For example, INSERT
, UPDATE
, and DELETE
commands.
DCL (Data Control Language)
These commands are used to control the visibility of data.
For example, GRANT
and REVOKE
commands.
TCL (Transaction Control Language)
These commands are used to manage the changes made by DML statements.
For example, COMMIT
, ROLLBACK
, and SAVEPOINT
commands.
DQL (Data Query Language)
These commands are used to fetch data from the database.
For example, SELECT
command.