Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone explain rollback in SQL?

1 Answer

0 votes
by (119k points)

The ROLLBACK command is a transactional control command used to roll back the changes that are not saved to the database. You have to create a SAVEPOINT before you delete records from the table so that you can roll back to that SAVEPOINT whenever needed.

Here is an example of how you can create SAVEPOINT and how to rollback to that SAVEPOINT:

SAVEPOINT savepoint_1;

DELETE FROM Employee

WHERE E_id = 797;

ROLLBACK to savepoint_1;

You can check out this SQL Tutorial blog to know more about ROLLBACK and how to use ROLLBACK.

Related questions

0 votes
1 answer
asked May 4, 2023 in SQL by neelimakv (32.5k points)
0 votes
1 answer
asked Apr 2, 2021 in SQL by dev_sk2311 (45k points)
0 votes
1 answer
0 votes
2 answers
asked Mar 23, 2021 in SQL by dev_sk2311 (45k points)

Browse Categories

...