A bank transfer takes money from Alice and gives it to Bob. Why wrap it in a transaction?

All or nothing: either both steps happen or neither does.

Start playing free

  1. To make the transfer run faster
  2. To encrypt the money
  3. So both steps happen, or neither does ✔

Why: Without a transaction, a crash between the two steps could take money from Alice without giving it to Bob. A transaction bundles the steps, and ROLLBACK cancels everything if something goes wrong.

Huh, didn't know that: This all-or-nothing property is the A in ACID: Atomicity, Consistency, Isolation, Durability.

The dad joke
My transaction was all or nothing. So I got nothing, but at least nobody lost money.
Like this card?
Play the game

References

Answer: So both steps happen, or neither does. Without a transaction, a crash between the two steps could take money from Alice without giving it to Bob. A transaction bundles the steps, and ROLLBACK cancels everything if something goes wrong.

  1. PostgreSQL Tutorial: Transactions www.postgresql.org/docs/current/tutorial-transactions.html
    The essential point of a transaction is that it bundles multiple steps into a single, all-or-nothing operation.
    Checked 2026-10-10.

Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.

Test yourself in the game