DCL (Data Control Language) Commands.

DCL Commands:

  • DCL is abbreviation of Data Control Language.
  • It is used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it.
  • GRANT – Gives user’s access privileges to database.
  • REVOKE – Withdraws user’s access privileges to database given with the GRANT command

Grant Command:

  • Grant is used to provide permissionslike Select, All, Execute to user on the database objects like Tables, Views, Databases etc.
  • Here privilageName is the the access right or permission that is granted to the userlike All, Select, Execute. objectName is the name of a database object like Table, View or Stored Procedure.

Syntax:

Grant  <privilageName> on <objectName> To {userName/Public/roleName}  [with Grant Option]

Example:           grant select on student to login1 with grant option

 

  • The above query select permission grant to student table .

Revoke Command:

  • Revoke is used to remove the permissions or privileges provided to a user by the Grant command.

    Syntax: Revoke  <privilageName> on <objectName>   from    {userName/public/roleName}

Example:      revoke select on test from public

 

Deny Command:

  • Denies permissions on a member of the OBJECT class of securables.

Syntax:    deny   <priviliagename>   on <object-name>  to  {username/public/rolename}

Example:            deny update on student to login1

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s