DCL commands are used to enforce database security in multiple user database environments. Two types of DCL commands are GRANT and REVOKE. Only Database Administrator's or owner's of the database object can provide/remove privileges on a database object.
SQL GRANT is a command used to provide access or privileges on the database objects to the users
Syntax-
- GRANT privilege_name
- ON object_name
- TO {user_name |PUBLIC |role_name}
- [WITH GRANT OPTION];
- CREATE ROLE testing
- GRANT CREATE TABLE TO testing;
The REVOKE command removes user access rights or privileges to the database objects.
- REVOKE privilege_name
- ON object_name
- FROM {user_name |PUBLIC |role_name}
- REVOKE CREATE TABLE FROM testing;
Comments
Post a Comment