Data Control Language (DCL) is a subset of SQL that focuses on managing access rights and permissions within a database. DCL commands are used to control who can do what in the database.
Command | Description |
---|---|
GRANT |
Gives a user specific privileges (e.g., to read or modify data) |
REVOKE |
Removes previously granted privileges from a user |
GRANT SELECT, INSERT ON Customers TO User123;
REVOKE INSERT ON Customers FROM User123;
SELECT
– Read data
INSERT
– Add new data
UPDATE
– Modify existing data
DELETE
– Remove data
ALL
– Grant all available privileges
DCL handles security and access control in the database.
Typically used by a database administrator (DBA).
Permissions can be granted at the table, column, or database level.
DCL operations are often transaction-dependent, requiring a COMMIT
to take effect.
DDL (Data Definition Language) – Defines the database structure (e.g., tables)
DML (Data Manipulation Language) – Works with the data itself (e.g., insert or update)
TCL (Transaction Control Language) – Manages transactions (COMMIT
, ROLLBACK
)
DCL (Data Control Language) – Manages permissions and user access