There are different types of statements that can be executed in SQL Server for different purposes. These are basically categorized into four types
- DDL – Data Definition Language
- DML – Data Manipulation Language
- DCL – Data Control Language
- TCL – Transaction Control Language
DDL(Data Definition Language)
The name itself suggests that it defines the structure of the database objects.
That is, it is used to create or modify the database or its objects. Some of the DDL commands are
CREATE – Creates a database or its objects like table, view, SP, etc.
ALTER – Modifies the structure of the DB or its objects.
DROP – Drops the structure of the DB or its objects.
TRUNCATE – Deletes the data from the table as well as the space allocated for the records. The structure of table remains same.
RENAME – Renames an object.
DML(Data Manipulation Language)
It deals with the retrieval and manipulation of the data stored in tables. Some of the SQL DML commands are
SELECT – Retrieves data from a table.
INSERT – Inserts data into a table.
UPDATE – Updates existing data in a table.
DELETE – Deletes data from the table.
MERGE – Performs insert or update operation.
DCL(Data Control Language)
It deals with the permissions and privileges of the objects. Two DCL commands are
GRANT – Provides user access to the database or its objects.
REVOKE – Restricts the user access to the database or its objects.
TCL(Transaction Control Language)
It deals with the transaction within the database. Some of the TCL commands are
COMMIT – Used to store the changes performed using a transaction.
ROLLBACK – Used to revert the changes up to the last committed state in case of any error.
SAVEPOINT – Used to roll the transaction back to a certain point.
Also, check “Create table using SELECT in MS SQL Server“
Reference – SQL Server statements