First, we need to understand the term database transaction.
When a multiple database operations are grouped together as one logical unit, we refer to the entire group as one transaction. Transactions are important in databases for two main reasons:
1. It allows for recovery from failure and this keeps the database consistent. Consider a situation where the operations within a transaction fails partially or completely, the system is able to roll back to the last consistent state before the transaction was initiated.
2. It allows for isolation between programs accessing the database concurrently. This prevents one program from making updates to columns already read by another program, or reading data that another program is updating within a transaction. This reduces the chances that a program output is flawed with errors.