Showing posts with label DCL. Show all posts
Showing posts with label DCL. Show all posts

Thursday, 8 January 2015

Data Control Language (DCL)

What is DCL? / List of operations that can be performed by Data Control Language / DCL examples / Different DCL commands

Data Control Language (DCL)

Data Control Language is used for controlling access privileges that are assigned for database users. It is one of the components of SQL like the DDL and DML. It does the following;

Granting privileges – through DCL we can permit individual users with individual permissions to access database and data differently. For example, we can restrict a user only to insert data into a table and to view data of the table. Some users may be permitted to create tables, some may be allowed to delete tables and so on.
This can be done with the GRANT command. For example, the following statement will allow a user to only insert the data into a table.
  • GRANT INSERT ON Teacher TO Kumar;
Here, Teacher is the table name and ‘Kumar’ is the name of the user. This statement permits the user Kumar to insert data into the table Teacher.
Other examples:
  • GRANT INSERT ON Teacher TO Kumar, User2;

Revoking privileges – we can revoke the privileges given to an user using revoking privileges statement.
For example, the following query will revoke the permission given to the user kumar in the previous statement.
  • REVOKE INSERT ON Teacher FROM Kumar;
Other examples:
  • REVOKE INSERT ON Teacher FROM Kumar, User2;

Lossless join decomposition one more example

Lossless Join Decomposition Question: Let R = {ssn, ename, pnumber, pname, plocation, hours} and R is decomposed into three re...