Revoking a Permission

Function

This statement is used to revoke permissions granted to a user or role.

Syntax

1
REVOKE (privilege,...) ON (resource,..) FROM ((ROLE [db_name].role_name) | (USER user_name)),...);

Keywords

ROLE: The subsequent role_name must be a role.

USER: The subsequent user_name must be a user.

Precautions

Example

To revoke the permission of user user_name1 to delete database db1, run the following statement:

1
REVOKE DROP_DATABASE ON databases.db1 FROM USER user_name1;

To revoke the SELECT permission of user user_name1 on table tb1 in database db1, run the following statement:

1
REVOKE SELECT ON databases.db1.tables.tb1 FROM USER user_name1;

To revoke the SELECT permission of role role_name on table tb1 in database db1, run the following statement:

1
REVOKE SELECT ON databases.db1.tables.tb1 FROM ROLE role_name;