SQL allows you to group multiple statements into a single atomic (indivisible) piece of work called a transaction. Successful transactions are preserved with the statement COMMIT WORK. The following example shows a simple transaction with two statements:
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;
If you do not want to keep a particular transaction, you can roll it back by using the statement:
ROLLBACK WORK;
If you do not explicitly commit your work, the data is discarded.