4.4 Data Control Language

DCL – GRANT and REVOKE statements.

DCL statements are those which are used to control access permissions on the tables, indexes, views and other elements of the DBMS.

Granting & Revoking Privileges

Query:

GRANT ALL <------------------

ON customers

TO ashraf;

Grants all permissions on the table customers to the user who logs in as 'ashraf'.



Query:

GRANT SELECT <--------------

ON customers

TO sunil;

Grants SELECT permission on the table customers to the user 'sunil'. User 'sunil' does not have permission to insert, update, delete or perform any other operation on customers table.

Query:

GRANT SELECT

ON customers

TO sunil

WITH GRANT OPTION; <---------

Enables user 'sunil' to give SELECT permission on customers table to other users.

Query:

REVOKE DELETE <-------------

ON customers

FROM ashraf;

Takes away DELETE permission on customers table from user 'ashraf'.

Powered by Blogger.