📘 What is DCL (Data Control Language)?

DCL (Data Control Language) is a subset of SQL used to control access to data in a database.
If SQL were a building, DCL would be the security system — determining who gets in, what they can do, and whether they can touch anything sensitive.


🧩 Role of DCL in SQL:

SQL is divided into several sub-languages:

TypePurposeExamples
DDLDefine structureCREATE, ALTER
DMLManage dataSELECT, INSERT, UPDATE, DELETE
DCLControl accessGRANT, REVOKE
TCLManage transactionsCOMMIT, ROLLBACK

So, DCL = security & permissions layer of SQL.


🔐 Key DCL Commands:

1. GRANT

Gives a user specific privileges on a database object.

GRANT SELECT, INSERT ON customers TO gaurav;

Gives user gaurav permission to SELECT and INSERT into the customers table.


2. REVOKE

Removes previously granted permissions.

REVOKE INSERT ON customers FROM gaurav;

Takes away the INSERT permission from gaurav on the customers table.


🛡️ Why DCL Matters:

ScenarioDCL Usage Example
Limit access for junior devsOnly allow SELECT, not DELETE
Secure sensitive tablesHR salary table → only HR team gets access
Handle third-party integrationsGrant limited access to APIs or analytics tools

⚠️ DCL is not transactional (usually)

  • In most DBMS systems, GRANT and REVOKE are immediate and auto-committed.

  • That means you can’t rollback a GRANT if it goes wrong.


🧠 Interview Line:

“DCL is the part of SQL that handles permissions using GRANT and REVOKE to control who can access or modify database objects.”