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 account by $500.
Increment checking account by $500.
Figure 13.1 shows the two SQL statements for this transaction. Now imagine that the DBMS fails—power outage, system crash, ...