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 and flow from this site, held on your device and searchable with no connection. Free to install, no ads.

Get it free on the App Store