SQL 2023 · Changing data

Group statements into a transaction

Make several changes succeed or fail together. Use ROLLBACK instead of COMMIT to undo them.

BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;

Official SQL 2023 documentation

More changing data commands

All changing data commands · SQL 2023 cheatsheet

Was this page helpful?