Wrap multiple changes in one transaction.
Section: Transactions
Begin, commit, and rollback
sql
sql
BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE account_id = 1;
UPDATE accounts SET balance = balance + 100 WHERE account_id = 2;
COMMIT;Explanation
If something fails, use ROLLBACK instead of COMMIT.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Transactions