A transaction is a sequential group of database manipulation operations, which is performed as if it were one single work unit. In other words, a transaction will never be complete unless each individual operation within the group is successful. If any operation within the transaction fails, the entire transaction will fail. Practically, we can club many SQL queries into a group and can execute all of them together as a part of a transaction.
Properties of Transactions
Transactions have the following four standard properties, usually referred to by the acronym ACID −
- Atomicity − This ensures that all operations within the work unit are completed successfully; otherwise, the transaction is aborted at the point of failure and previous operations are rolled back to their former state.
- Consistency − This ensures that the database properly changes states upon a successfully committed transaction.
- Isolation − This enables transactions to operate independently on and transparent to each other.
- Durability − This ensures that the result or effect of a committed transaction persists in case of a system failure.