Summary -

In this topic, we described about the Data Control Language with detailed example.

Data Control language is used for controlling of data by giving/revoking the access to retrieve the data based on the levels at users group level or individual user level . One of the main advantages of DCL is, User groups can be restricted by revoking the access for the sensitive data.DCL has mainly two statements

  1. GRANT
  2. REVOKE

GRANT:

GRANT statement is used to give the permissions which also used to add the additional permissions to users which already created earlier.

Syntax -

GRANT [statement] ON [DB_OBJECT] TO PUBLIC/Group-of-users

Example:

GRANT SELECT ON TABLE1 TO PUBLIC

In the above example, the query will give the SELECT access to all users which will have retrieve access to table existed database.

REVOKE:

REVOKE statement is used to revert the access which is granted earlier. It is also used to REVOKE the userid’s which are currently working.

Syntax -

REVOKE [statement] ON [DB_OBJECT] TO PUBLIC/Group-of-users

Example:

REVOKE SELECT ON TABLE1 TO PUBLIC