Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Tuesday 20 February 2024

GRANT and REVOKE in TERADATA

In Teradata, the GRANT and REVOKE statements are used to manage access privileges for users or roles on various database objects.


 GRANT:


The GRANT statement is used to give specific privileges to users or roles.

Syntax:


GRANT privilege(s)

    ON object_name

    TO {user_name | role_name};


Example:


GRANT SELECT, INSERT ON database_name.table_name

    TO user1;


This grants the SELECT and INSERT privileges on the specified table to user1.


GRANT UPDATE(column1, column2) ON database_name.table_name

    TO role1;


This grants the UPDATE privilege on specific columns of the specified table to role1.


 REVOKE:


The REVOKE statement is used to take back privileges that have been granted from users or roles.


Syntax:


REVOKE privilege(s)

    ON object_name

    FROM {user_name | role_name};


Example:


REVOKE SELECT, INSERT ON database_name.table_name

    FROM user1;


This revokes the SELECT and INSERT privileges on the specified table from user1.


REVOKE UPDATE(column1, column2) ON database_name.table_name

    FROM role1;


This revokes the UPDATE privilege on specific columns of the specified table from role1.


Remember to use these statements carefully to maintain the security and integrity of your Teradata database.

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.