0 votes
142 views
in DataBase Management System by (98.9k points)
edited
Explain DCL commands with an example.

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer

DCL (Data Control Language) commands are used to control access to a database. Here's an explanation of two common DCL commands with examples:

  1. GRANT: The GRANT command is used to give users or roles access to specific database objects or operations. The syntax for the GRANT command is:

    GRANT privileges ON object TO user;

    For example, to give a user named "Alice" SELECT privileges on the "Employees" table, we might use the following command:

    GRANT SELECT ON Employees TO Alice;

    This command gives Alice the ability to retrieve data from the "Employees" table.

  2. REVOKE: The REVOKE command is used to revoke previously granted access privileges. The syntax for the REVOKE command is:

    REVOKE privileges ON object FROM user;

    For example, to revoke the SELECT privileges that we previously granted to Alice on the "Employees" table, we might use the following command:

    REVOKE SELECT ON Employees FROM Alice;

    This command removes Alice's ability to retrieve data from the "Employees" table.

DCL commands are important for ensuring the security and integrity of a database by controlling who has access to it and what they can do with it.

Related questions

0 votes
1 answer 111 views
0 votes
1 answer 221 views
0 votes
1 answer 159 views
0 votes
1 answer 128 views
0 votes
1 answer 144 views
0 votes
1 answer 117 views

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

561 users

...