You are on page 1of 7

Name: Aman Chavan

PRN: 120A7016
Div: B(SE-ECS)

EXPERIMENT NO. 8

AIM: Perform DCL and TCL commands.

OBJECTIVES: Learn to implement different DCL statements to allow or restrict the user from
accessing data in database schema.

THEORY:

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.


In DCL we have two commands,

• GRANT: Used to provide any user access privileges or other privileges for the database.

• REVOKE: Used to take back permissions from any user.

1. 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 SELECT ,UPDATE, DELETE ON employee


TO ABC;
NOTE: If all permission required in one go then use
Syntax

Department of EXTC, SIES GST


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.

Department of EXTC, SIES GST


2. 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;

Department of EXTC, SIES GST


BEGIN:

Department of EXTC, SIES GST


UPDATE:

Department of EXTC, SIES GST


COMMIT:

Department of EXTC, SIES GST


Department of EXTC, SIES GST

You might also like