HomeTechnologyDatabasesWhat is Transaction?
Technology·2 min·Updated Mar 9, 2026

What is Transaction?

Database Transaction

Quick Answer

A transaction is a sequence of operations performed as a single logical unit of work in a database. It ensures that all operations succeed or fail together, maintaining data integrity.

Overview

In the context of databases, a transaction is a series of actions that are treated as a single unit. This means that either all the actions are completed successfully, or none of them are applied at all. This is crucial for maintaining the integrity of the data, especially in situations where multiple operations depend on each other, such as transferring money between bank accounts. For example, consider a scenario where you want to transfer money from your checking account to your savings account. The transaction would involve deducting the amount from the checking account and adding it to the savings account. If the deduction happens but the addition fails, your money would be lost, which is why transactions ensure that both actions must succeed together or not at all. Transactions are important in databases because they help prevent data corruption and ensure consistency. They follow the ACID properties: Atomicity, Consistency, Isolation, and Durability. These properties guarantee that transactions are processed reliably, which is essential for applications like banking, e-commerce, and any system that requires accurate and reliable data handling.


Frequently Asked Questions

The ACID properties stand for Atomicity, Consistency, Isolation, and Durability. These principles ensure that transactions are completed reliably and that the database remains in a consistent state even in the event of a failure.
Transactions help maintain data integrity by ensuring that a series of operations are completed successfully as a single unit. If any part of the transaction fails, the entire operation is rolled back, preventing partial updates that could lead to data inconsistencies.
While most relational databases support transactions, not all types of databases do. For example, some NoSQL databases may not provide full transaction support, focusing instead on scalability and performance.