Difference between Grant and Revoke
Data Controlling Language (DCL) helps users to retrieve and modify the data stored in the database with some specified queries. Grant and Revoke belong to these type of commands of the Data controlling Language. DCL is a component of SQL commands.
1. Grant :
SQL Grant command is specifically used to provide privileges to database objects for an user. This command also allows users to grant permissions for other users too.
Syntax:
grant privilege_name on object_name
to {user_name | public | role_name}
Here privilege_name is which permission has to be granted, object_name is the name of the database object, user_name is the user to which access should be provided, public is used to permit the access to all the users.
2. Revoke :
Revoke command withdraw user privileges on database objects if any granted. It does operations opposite to the Grant command. When a privilege is revoked from a particular user U, then the privileges granted to all other users by user U will be revoked.
Syntax:
revoke privilege_name on object_name
from {user_name | public | role_name}
Example:
grant insert, select on accounts to Ram
By the above command user ram has granted permissions on accounts database object like he can query or insert into accounts.
revoke insert, select on accounts from Ram
By the above command user ram’s permissions like query or insert on accounts database object has been removed.

To know the exact synatx and how are they used click here.
Differences between Grant and Revoke commands :
| S.NO | Grant | Revoke |
|---|---|---|
| 1 | This DCL command grants permissions to the user on the database objects. | This DCL command removes permissions if any granted to the users on database objects. |
| 2 | It assigns access rights to users. | It revokes access rights of users. |
| 3 | For each user you need to specify the permissions. | If access for one user is removed; all the particular permissions provided by that users to others will be removed. |
| 4 | When the access is decentralized granting permissions will be easy. | If decentralized access removing the granted permissions is difficult. |
Recommended Posts:
- MySQL | Grant / Revoke Privileges
- Difference between H.323 and SIP
- What is the difference between GUI and CUI?
- Difference between ELT and ETL
- Difference between URL and URI
- Difference between WCF and Web API
- Difference Between SEO and SEM
- Difference between MP4 and MP3
- Difference between OOP and POP
- Difference between T-SQL and PL-SQL
- Difference Between BFS and DFS
- What is the difference between (NaN != NaN) & (NaN !== NaN)?
- Difference between 1G and 2G
- Difference between LAN and WAN
- Difference between LAN, MAN and WAN
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.

