What is a Transaction in DBMS?

A transaction in the context of a Database Management System (DBMS) is a logical unit of work that performs one or more operations (such as INSERT, UPDATE, DELETE, or SELECT) on a database. These operations are grouped together to ensure that they are executed as a single, indivisible unit, which either completes fully (commit) or fails entirely (rollback). This ensures data consistency, integrity, and reliability.


Key Properties of Transactions (ACID Properties)

  1. Atomicity:
  2. Consistency:
  3. Isolation:
  4. Durability:

States of a Transaction

A transaction progresses through the following states:

  1. Active: The transaction is in progress.
  2. Partially Committed: All operations have been executed, but changes are not yet permanent.
  3. Committed: The transaction successfully completes, and changes are saved permanently.
  4. Failed: An error occurs, and the transaction cannot proceed further.
  5. Aborted: Changes made during the transaction are rolled back, restoring the database to its original state.