DCL stands for Data Control Language in Structured Query Language (SQL). As the name suggests these commands are used to control privilege in the database. The privileges (Right to access the data) are required for performing all the database operations like creating tables, views, or sequences.
DCL command is a statement that is used to perform the work related to the rights, permissions, and other control of the database system.
There are two types of Privileges in database:
- System Privilege
- Object Privilege
Need Of DCL commands
- Unauthorized access to the data should be prevented in order to achieve security in our database
- DCL commands maintain the database effectively than anyone else other than database administrator is not allowed to access the data without permission.
- These commands provide flexibility to the data administrator to set and remove database permissions in granular fashion.
Commands in DCL
The two most important DCL commands are:
This command is used to grant permission to the user to perform a particular operation on a particular object. If you are a database administrator and you want to restrict user accessibility such as one who only views the data or may only update the data. You can give the privilege permission to the users according to your wish.
GRANT privilege_list ON Object_name TO user_name;
This command is used to take permission/access back from the user. If you want to return permission from the database that you have granted to the users at that time you need to run REVOKE command.
REVOKE privilege_list ON object_name FROM user_name;
Following commands are granted to the user as a Privilege List:
Advantages Of DCL commands
- It allows to restrict the user from accessing data in database.
- It ensures security in database when the data is exposed to multiple users.
- It is the wholesome responsibility of the data owner or data administrator to maintain the authority of grant and revoke privileges to the users preventing any threat to data.
- It prevents other users to make changes in database who have no access to Database
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- SQL | DDL, DQL, DML, DCL and TCL Commands
- SQL | DDL, DML, TCL and DCL
- TCL Full Form
- LFU Full Form
- VPN Full Form
- DOS Full Form
- SAS Full Form
- OSI Model Full Form in Computer Networking
- HDMi Full Form
- LCD Full Form
- ZIP Full Form
- API Full Form
- RTC Full Form
- VLAN Full Form
- WPA Full Form
- DQL Full Form
- VGA Full Form
- ISP Full Form
- SGML Full Form
- DHCP Full Form
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.