Database Management Systems (2130703)

BE | Semester-3   Summer-2018 | 05/23/2018

Q4) (a)

Describe GRANT and REVOKE commands.

GRANT

GRANT is a command used to provide access or privileges or rights on the database objects to the users.

Syntax:

  GRANT privilege_name
  ON object_name
  TO {user_name |PUBLIC}
  [WITH GRANT OPTION];

Explanation:

  • 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.
  • WITH GRANT OPTION - allows a user to grant (give) access rights to other users.

REVOKE

The REVOKE is a command used to take back access or privileges or rights on the database objects from the users.

Syntax:

  REVOKE privilege_name
  ON object_name
  FROM {user_name |PUBLIC }

Explanation:

  • privilege_name is the access right or privilege want to take back from 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 from whom an access right is being taken back.
  • PUBLIC is used to take back access rights to all users.