ROLLBACK

 In this lesson we are going to study about how to discard all changes made in database.


Rollback:
  • It is used to discard the changes made on database .
  • This command discards all the changes made on the database since the last transaction .
Syntax:

ROLLBACK;

  After excuting  the ROLLBACK statement the state of data is rolled back to the way it was the changes where made .

Example:
  Lets say we are going to update the salary of all employees  with 100.

Update emp set salary=salary+100;


  This statement update the salary of  emp table  with 100 mean while the chages  made on this table not written to the database until the session is closed or the user COMMIT the transaction .
 ROLLBACK  is used in a situation when we want to leave the above changes .So we can ROLLBACK  to above changes made on the database using the ROLLBACK command.

ROLLBACK;


Related Article:

 I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebooktwitter

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends:

No comments:

Post a Comment