DCL Full Form

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.

DCL-Full-Form

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:

  • GRANT
  • REVOKE

GRANT

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.



Syntax:

GRANT privilege_list
ON Object_name
TO user_name;

REVOKE

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.

Syntax:

REVOKE privilege_list
ON object_name
FROM user_name;

Following commands are granted to the user as a Privilege List:

  • EXECUTE
  • UPDATE
  • SELECT
  • DELETE
  • ALTER
  • ALL

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.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.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.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.