How Do Database Transactions Work?
A database transaction consists of any unit of work that is conducted inside of a database management or equivalent system. The operation must be against a database and be treated as an independent operation from other transactions. The primary two purposes of a transaction are:
1 – Providing reliable units of work that are able to recover correctly from failure, and
2 – Keep a database consistent in all situations to include system failure, unexpected execution corruption, and supporting numerous incomplete operations on the database.
In order to be considered a database transaction, the operation must support the core principles of transactions to being atomic, consistent, isolated, and durable. If a transaction is not completed the desired outcome of the operation will not be realized due to the requirements of database transactions.