Thursday, January 8, 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, SELECT ON Teacher TO Kumar;
  • 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;




No comments:

Post a Comment

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents