Chapter 14. Transactions
A transaction is a sequence of one or more SQL statements executed as a single logical unit of work. The DBMS considers a transaction to be an indivisible, all-or-nothing proposition: It executes all the transaction's statements as a group, or it executes none of them.
Canonical law requires me to illustrate the importance of transactions with a banking example. Suppose that a customer transfers $500 from her savings account to her checking account. This operation consists of two separate actions, executed sequentially:
Decrement savings balance by $500.
Increment checking balance by $500.
Figure 14.1 shows the two SQL statements for this transaction. Now imagine that the DBMS fails—power outage, system crash, hardware problem—after ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access