Sunday, 3 September 2017

What is the Difference between DDL, DML, DCL and TCL Statements in SQL

SQL language is divided into four types of primary language statements.

Follows mention regarding the four main categories of SQL statements:




1. DDL (Data Definition Language)
2. DML (Data Manipulation Language)
3. DCL (Data Control Language)
4. TCL (Transaction Control Language)

DDL (Data Definition Language)

DDL statements are used to define data structures or Schema.
For Example -
CREATE – create a new Table, database, schema
ALTER – alter existing table, column description
DROP – delete existing objects from database


DML (Data Manipulation Language)

DML statements are used to manipulate data itself.
For Example -
SELECT – select records from a table
INSERT – insert new records
UPDATE – update/Modify existing records
DELETE – delete existing records

DCL (Data Control Language)

DCL statements are used to control the level of access that users have on database objects.
For Example -
GRANT – allows users to read/write on certain database objects
REVOKE – keeps users from read/write permission on database objects

TCL (Transaction Control Language)

TCL statements are used to control and manage transactions to maintain the integrity of data within SQL statements.
For Example -
BEGIN Transaction – opens a transaction
COMMIT Transaction – commits a transaction
ROLLBACK Transaction – ROLLBACK a transaction in case of any error

No comments:

Post a Comment

Single Responsibility Principle (SRP)