DCL means Data Control Language. These statements are used
for controlling the access to database objects for users. Generally these
statements will be used by DBA people to control the access of users to the
database.
GRANT:
Grant will be used for giving
permissions on the database to users. Using this we can give any type of
permissions to the users on the database.
For
example if we want to give Select permission on all the database tables to a user,
- GRANT SELECT ANY TABLE TO user_name;
If
we want to give select permission on specific table then
- GRANT SELECT ON tab_name TO user_name;
If
we want to give Create table permission then,
- GRANT CREATE TABLE TO user_name;
REVOKE:
Revoke
will be used to remove the permissions which are granted previously to the
users on the database. If we want to remove permissions given in the above
statements, then we can use following statements.
- REVOKE SELECT ANY TABLE FROM user_name;
- REVOKE SELECT ON tab_name FROM user_name;
- REVOKE CREATE TABLE FROM user_name;