Rollback

It is used to undo the change of the current transaction.

ROLLBACK ;
ROLLBACK TRANSACTION ;
ROLLBACK WORK ;

Example: When transferring to accounts, let’s make a transfer to the wrong account and cancel the change.

BEGIN;
UPDATE hesaplar SET bakiye = bakiye - 1500 WHERE id = 3;
UPDATE hesaplar SET bakiye = bakiye + 1500 WHERE id = 2;
ROLLBACK;