Sams Teach Yourself SQL in 24 Hours, Third Edition By Ronald R. Plew, Ryan K. Stephens
Table of Contents
Hour 6. Managing Database Transactions
A transaction is a unit of work that is performed against a database. Transactions are units or sequences of work accomplished in a logical order, whether in a manual fashion by a user or automatically by some sort of a database program. In a relational database using SQL, transactions are accomplished using the DML commands that were discussed during Hour 5, "Manipulating Data" (INSERT, UPDATE, and DELETE). A transaction is the propagation of one or more changes to the database. For instance, you are performing a transaction if you performed an UPDATE statement on a table to change an individual's name .
A transaction can either be one DML statement or a group of statements. When managing transactions, each designated transaction ( group of DML statements) must be successful as one entity or none of them will be successful.
The following list describes the nature of transactions:
All transactions have a beginning and an end.
A transaction can be saved or undone.
If a transaction fails in the middle, no part of the transaction can be saved to the database.
To start or execute transactions is implementation-specific. You must check your particular implementation for how to begin transactions. There is no explicit start or begin transaction in the ANSI standard.