1
SQLAdvanced#transactions
Atomicity: a transaction is all-or-nothing. Consistency: it moves the database from one valid state to another. Isolation: concurrent transactions do not corrupt each other. Durability: committed data survives a crash.
BEGIN; UPDATE accounts SET balance = balance - 500 WHERE id = 1; UPDATE accounts SET balance = balance + 500 WHERE id = 2; COMMIT; -- both succeed or neither does