JAEN

SQL

BEGIN / COMMIT / ROLLBACK

CautionTransactions

BEGIN; ... COMMIT;

Makes multi-statement changes atomic. For manual fixes: BEGIN, verify with SELECT, then COMMIT — or ROLLBACK.

Examples

  • BEGIN; UPDATE accounts SET bal = bal - 100 WHERE id=1; ROLLBACK;Try, verify, roll back

Syntax

BEGIN; <statements>; COMMIT; (取消は ROLLBACK;)

Before you run it

No undo after COMMIT; idle transactions hold locks.

Used when you see

Deadlocks and lock waits
3
Refactor to keep transactions short
See the whole flow →

Related commands

The same reference, with no signal at all

Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).

Get it free on the App Store