SQL Guide : Database concepts : Transactions
  
Transactions
SQL allows you to group multiple statements into a single “atomic” (indivisible) piece of work called a transaction. For example, if you write a check to a grocery store, then the grocery store’s bank account should be given the money at the same instant that the money is withdrawn from your account. It would not make sense for you to pay the money without the grocery store receiving it, and it would not make sense for the grocery store to be paid without your account having the money subtracted. If either of these operations (adding to the grocery store’s account or subtracting from yours) fails, then the other one ought to fail, too. If both statements are in the same transaction, and either statement fails, you can use the ROLLBACK command to restore things as they were before the transaction started — this prevents half-successful transactions from occurring. If both halves of our financial transaction are successful, we would like our database transaction to be successful, too. Successful transactions are preserved with the command COMMIT WORK. Below is a simplistic example.
COMMIT WORK; -- Finish the previous transaction.
UPDATE stores SET balance = balance + 199.95
 WHERE store_name = 'Big Tyke Bikes';
UPDATE checking_accounts SET balance = balance - 199.95
 WHERE name = 'Jay Smith';
COMMIT WORK;
See also
Database concepts