Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Control Language Grant, Revoke.

Similar presentations


Presentation on theme: "Data Control Language Grant, Revoke."— Presentation transcript:

1 Data Control Language Grant, Revoke

2 Privileges Select Insert Update Delete Reference

3 Grant Command Give the permission to others user. Syntax
Grant <privileges> on <tablename> to <username> Example SQL>Grant select on emp to user1;

4 Example SQL> Grant select, insert on emp to user2;
SQL> Grant update(comm) on emp to user3; SQL> grant update (salary, comm) on emp to user4; SQL> Grant select (dno=10) on emp to user5;

5 Revoke Command Cancel the permission Syntax
Revoke <privileges> on <tablename> from <username> Example SQL>Revoke select on emp from user1;

6 Example SQL> Revoke select, insert on emp from user2;
SQL> Revoke update(comm) on emp from user3; SQL> Revoke update (salary, comm) on emp from user4; SQL> Revoke select (dno=10) on emp from user5;

7 Example SQL> Grant select, insert, update, Delete on emp to user2;
SQL> Revoke insert, Delete on emp from user2;

8 Transaction Control Language
Commit, Rollback, Savepoint, Grant,Revoke The TCL statements give you flexibility to undo transactions or write transactions to the disk Transactions provide consistency in case of a system failure.

9 Current transaction and writes all changes permanent to the disk.
Commit Current transaction and writes all changes permanent to the disk. Savepoint Marks a point in the current transaction Rollback to [savepoint n] Undoing all changes if n to savepoint undo the n position

10 Example SQL> insert into emp values ( &empno, &ename, &salary, &dno, &comm); SQL>/ (input some record) SQL> select * from emp; SQL> Commit; SQL> Delete from emp where comm>=2500; SQL> Select * from emp; SQL> Rollback; SQL> Savepoint x; SQL> delete from emp where dno=10; SQL> Roolback to x;

11 Set Operations Union Intersect Minus

12 Union Returns all distinct rows from both queries. Example
SQL> Select * from emp1 union select * from emp2; A={ 1,5,6,3} b= {6,8,4,3,2} AUB = { 1,5, 6,3,8,4,2} SQL> select city from salesman union select city from customer;

13 UNION ALL Display including duplicates record Example
SQL> Select * from emp1 union all select * from emp2; A={ 1,5,6,3} b= {6,8,4,3,2} AUB = { 1,5, 6,3,6,8,4,3,2} SQL> select city from salesman union all select city from customer;

14 Intersect Returns common rows selected by both queries Example
SQL> Select * from emp1 intersect select * from emp2; A={ 1,5,6,3} b= {6,8,4,3,2} AUB = { 6,3 } SQL> select city from salesman union select city from customer;

15 Minus Returns all distinct rows that


Download ppt "Data Control Language Grant, Revoke."

Similar presentations


Ads by Google