GRANT and REVOKE command in SQL

The difference between the GRANT and REVOKE command is as under:

SQL GRANT Command

SQL GRANT is a command used to provide access or privileges on the database objects to the users. The Syntax for the GRANT command is:

GRANT privilege_name

ON object_name

TO {user_name |PUBLIC |role_name}

[WITH GRANT OPTION];

 

SQL REVOKE Command:


The REVOKE command removes user access rights or privileges to the database objects.The Syntax for the REVOKE command is:

REVOKE privilege_name

ON object_name

FROM {user_name |PUBLIC |role_name}

  • privilege_name is the access right or privilege granted to the user. Some of the access rights are ALL, EXECUTE, and SELECT.
  • object_name is the name of an database object like TABLE, VIEW, STORED PROC and SEQUENCE.
  • user_name is the name of the user to whom an access right is being granted.
  • PUBLIC  is used to grant access rights to all users.
  • role are a set of privileges grouped together.
  • WITH GRANT OPTION- allows a user to grant access rights to other users
  • Ebook Download
    View all
    Learn
    View all
    F11Research & Development, LLC