TCL &DCL

Transaction Control Language:-
  1. Transaction is a logic unit of work
  2. Whatever the changes we made to the DataBase can be referred as a Transaction.
  3. Whenever we perform a DML operation like select,update,insert ,delete the results will be stored in Buffer .But not in Permanent Database .
  4. The user Can control the transaction changes with the use of  TCL Commands
1}Commit
2}RollBacka
3}Save Transaction
In general these commands are used for managing the changes affecting the data.
1)Commit:-
It is used to save the work Done /Used to Make changes permanently SY:-Begin Transaction Transaction Name
2)Rollback:-
    This Command is used to restore the database to original since the last Commit.
     Rollback command can only be used to Undo transactions since last                .........commit/Rollback Command was used.
      SY:-Rollback Transaction Transaction Name

3)SavePoint:-
    It is a mechanism to rollback portion of transactions
    In general Savepoint is used to create points within group of transactions which to ......Rollback.
1.Ex
          begin transaction sampath—creating a transaction
          after creating the transaction iam deleting the records like
          delete from employee where empid=1
          delete from employee where empid=3
          rollback transaction sampath

2.Ex
          begin transaction krishna
          insert into employee values(3,'parveen',90000)
          insert into employee values(3,'krishna',22000)
          commit transaction krishna
          select *  from employee
          rollback transaction krishna

Data Control Language:-

These Sql Commands are used for providing the security to database objects.
1)Grant
2)Revoke

(1)Grant:- 
This command is used for give access privileges to users for database
Previleges are:-Select ,Insert,Update,Delete.
Syntax:-Grant <Previleges>  on <Table Name > to <Users> [with Grant Option]
Ex:-Grant select,insert on Employee to Krishnaveni

(2)Revoke:-
These commands are Used for Withdraw access privileges to users for database.
Sy:-Revoke <Privileges > on Table Name from <users>
Ex:-revoke select,insert on Employee from Krishnaveni Cascade

No comments:

Post a Comment