written 6.1 years ago by |
DCL :
DCL stands for Data Control Language.
DCL is used to control user access in a database.
This command is related to the security issues.
Using DCL command, it allows or restricts the user from accessing data in database schema.
DCL commands are as follows,
- GRANT
- REVOKE
It is used to grant or revoke access permissions from any database user.
GRANT COMMAND
GRANT command gives user's access privileges to the database.
This command allows specified users to perform specific tasks.
Syntax:
GRANT <privilege list>
ON <relation name or view name>
TO <user/role list>;
Example : GRANT Command
GRANT ALL ON employee TO ABC; [WITH GRANT OPTION]
In the above example, user 'ABC' has been given permission to view and modify the records in the 'employee' table.
REVOKE COMMAND
REVOKE command is used to cancel previously granted or denied permissions.
This command withdraw access privileges given with the GRANT command.
It takes back permissions from user.
Syntax:
REVOKE <privilege list>
ON <relation name or view name>
FROM <user name>;
Example: REVOKE Command
REVOKE UPDATE
ON employee
FROM ABC;