Transfer both sides or neither

When a bank moves money between two accounts in its database, one balance goes down and the other goes up. If something fails halfway through, a transaction undoes the first change so the money does not vanish. Saving all the changes is called committing; undoing them is a rollback.

The app still has to check that the sending account has enough money.

The four ACID promises

ACID names four common transaction properties: atomicity (all changes or none), consistency (database rules still hold), isolation (simultaneous changes do not interfere unexpectedly), and durability (saved changes survive a failure). The exact guarantees depend on the database, and long transactions can hold up other work.