Transactions resemble a stop-light system. Incoming traffic halts at
a red light for a period while traffic traveling together in the
other direction moves through the intersection.
A practical example might be a banking application where a transfer
from savings to checking involves changing the balance in the savings
and then changing the balance in the checking. This application might
have these two SQL statements:
# Deduct $100 from the $110 in the savings account
UPDATE account
SET balance = 10.00
WHERE id = 1234
# Add $100 to the $55 in the checking account
UPDATE account
SET balance = 155.00
WHERE id = 5678
Between the two updates, another transaction could be issued by
another client that checks the balance of the checking and savings
accounts to see if there is enough money for a check. If that were to
happen, the check would bounce. Worse still, if the server crashed
between the two updates, your client would have just lost $100 to the
bit bucket.