Dcl Commands In Sql in SQL
? DCL Commands in SQL
DCL stands for Data Control Language. These commands control access and permissions on the database objects, ensuring security.
? Main DCL Commands
| Command | Purpose | Example |
|---|---|---|
GRANT | Give users privileges to perform actions | sql<br>GRANT SELECT, INSERT ON employees TO user1;<br> |
REVOKE | Remove privileges previously granted | sql<br>REVOKE INSERT ON employees FROM user1;<br> |
? Details
GRANT: Assigns rights like
SELECT,INSERT,UPDATE,DELETE,EXECUTE, etc.REVOKE: Takes back those rights.
Controls who can access, modify, or manage database objects.
? Example: Grant Select Access
GRANT SELECT ON employees TO user1;User user1 can now only read data from employees.
? Example: Revoke Insert Access
REVOKE INSERT ON employees FROM user1;User user1 loses permission to insert data into employees.
If you want, I can show you DCL commands with roles, advanced permissions, or examples for specific SQL databases!