about 9 years ago
Transactions are very important part of MySql and for handling the transactions the Transaction Control Language (TCL) is used. Transactions are basically used to handle all the changes made in the database. Rolling back a transaction means storing the database to the last commited state. The Rollback statement can be understood with the help of other statements. The following commands should be understood for rollback of the transaction:-
Example for rollback of transaction-
Suppose there is a table by name Customers
INSERT into CUSTOMERS values(4,'alex','Germany');
commit;
UPDATE CUSTOMERS set name='Julia' where PId='4';
savepoint A;
Now the table will look like:-
Now if we have to rollback the transaction to the SAVEPOINT A , the command should be-
rollback to A;
SELECT * from CUSTOMERS;
0 Comment(s)