Transactions & ACID Properties in DBMS: Real-Life Examples & Transaction States

DBMS Chapter 19 · Transaction Control Tower
Transactions & ACID Properties in DBMS: Real-Life Examples & Transaction States

A transaction is a logical unit of database work that should either complete correctly as a whole or leave the database in a safe state. The four ACID properties are Atomicity, Consistency, Isolation and Durability. Together, they help a DBMS protect data during operations such as bank transfers, ticket booking, online payments and order placement. This chapter explains transactions from zero, including READ and WRITE operations, COMMIT, ROLLBACK, SAVEPOINT, transaction states, failures and real-life examples.

Transaction from zero ACID with real life Interactive bank transfer Transaction states COMMIT / ROLLBACK / SAVEPOINT Checked: 19 September 2026
Quick answer first

What Is a Transaction in DBMS?

Transactions & ACID Properties in DBMS: Real-Life Examples & Transaction States

A transaction is a sequence of one or more database operations treated as one logical unit of work. It should finish completely or be undone safely if something goes wrong.

Think of an online bank transfer of Rs 500 from Asha to Ravi. The database must reduce Asha's balance and increase Ravi's balance. These two changes belong to one logical transaction.

BEGINTransaction starts.
READRead current balances.
WRITEUpdate both accounts.
CHECKMake sure rules still hold.
COMMITMake changes permanent.

Memory line

Transaction = one complete logical job

If you need SQL command basics first, revise SQL Basics in DBMS. For data-validity rules, revise Integrity Constraints in DBMS.

Why transactions are needed

Why Does a DBMS Need Transactions?

Without transactions, a system could leave half-finished work in the database. That is dangerous because users usually expect one business action to behave like one unit.

Bank transferDebit and credit must belong to the same transaction.
Ticket bookingSeat reservation and payment status should remain consistent.
E-commerce orderOrder, stock and payment records may need coordinated changes.
College fee paymentPayment record and student fee balance must not disagree.

The DBMS uses transactions so that failures, concurrent users and system crashes do not easily leave the database in an inconsistent state.

Core operations

Basic Transaction Operations: READ and WRITE

In DBMS theory, a transaction is often shown with simple read and write operations.

read(X)
X = X - 500
write(X)

read(Y)
Y = Y + 500
write(Y)

Here X may represent Asha's balance and Y Ravi's balance.

READ(X)

Copies the current value of database item X into the transaction's local working area.

WRITE(X)

Writes the transaction's changed value of X back to the database.

Actual DBMSs hide many internal details, but this notation is useful for understanding schedules, concurrency control and recovery.

The foundation

What Are ACID Properties?

ACID stands for Atomicity, Consistency, Isolation and Durability. These are the four main reliability properties expected from database transactions.

AAtomicity

All operations of a transaction happen, or none of them are kept.

CConsistency

A successful transaction should move the database from one valid state to another valid state.

IIsolation

Concurrent transactions should not interfere in a way that breaks the required correctness guarantees.

DDurability

Once a transaction is committed, its effects should survive later failures such as a crash.

A = all or nothing · C = valid state · I = safe concurrency · D = committed means lasting
ACID property 01

Atomicity Explained With a Bank Transfer

Suppose Asha sends Rs 500 to Ravi.

Step 1: Asha balance - 500
Step 2: Ravi balance + 500

Imagine the server crashes after Step 1 but before Step 2. If the first change remained permanent, money would disappear from the system.

Atomicity prevents this half-completed result. The DBMS should either complete both steps or undo the incomplete transaction.

Atomicity shortcut

All operations or zero operations
ACID property 02

Consistency Explained Simply

Consistency means a transaction should respect the database's rules, constraints and application invariants.

Suppose the total money before transfer is:

Asha = Rs 5,000
Ravi = Rs 3,000
Total = Rs 8,000

After transferring Rs 500:

Asha = Rs 4,500
Ravi = Rs 3,500
Total = Rs 8,000

The transaction changed individual balances but did not create or destroy money in this simple example.

Consistency does not mean every database automatically knows every business rule. The rules must be represented through constraints, correct transaction logic and other controls. The DBMS then helps enforce them.

ACID property 03

Isolation Explained With Two Users

Suppose two people try to use the same account at nearly the same time. One transaction is withdrawing money while another transaction is checking or changing the same balance.

If the operations are mixed carelessly, one transaction may see incomplete changes from another transaction or overwrite another update.

Poor isolation

One transaction can observe or interfere with another transaction's intermediate work in an unsafe way.

Proper isolation

The DBMS controls concurrent execution so the result satisfies the chosen isolation guarantees.

Isolation is closely connected to schedules, serializability, locks, timestamps and isolation levels. Those are usually studied in the next concurrency-control chapter.

ACID property 04

Durability Explained With a Power Failure

Suppose a transaction is committed and the user sees “Payment successful.” One second later, the database server loses power.

Durability means the committed result should not simply disappear after the crash.

DBMSs commonly use recovery techniques such as logs and stable storage mechanisms so committed work can be preserved or recovered.

Durability shortcut

COMMIT means the result should survive later failures
Interactive real-life example

Bank Transfer Transaction Simulator

Assume Asha has Rs 5,000 and Ravi has Rs 3,000. The transaction transfers Rs 500.

Successful transfer

BEGIN Asha: 5000 -> 4500 Ravi: 3000 -> 3500 COMMIT

What should happen?

Both updates become permanent The transaction completes successfully and keeps the database consistent.
COMMITTED
Transaction control commands

COMMIT, ROLLBACK and SAVEPOINT

COMMITMakes the transaction's successful changes permanent.
ROLLBACKUndoes uncommitted changes according to DBMS transaction rules.
SAVEPOINTMarks an intermediate point to which a transaction may roll back without cancelling everything.

Example

START TRANSACTION;

UPDATE accounts
SET balance = balance - 500
WHERE account_id = 101;

SAVEPOINT after_debit;

UPDATE accounts
SET balance = balance + 500
WHERE account_id = 202;

COMMIT;

If a later step fails and the DBMS supports the required behavior, a rollback can undo the uncommitted work. Exact syntax differs across MySQL, PostgreSQL, Oracle and SQL Server.

Important caution

COMMIT vs ROLLBACK

PointCOMMITROLLBACK
Main purposeConfirm successful transaction changesUndo uncommitted transaction changes
EffectChanges become durable according to DBMS guaranteesDatabase returns to an earlier safe transaction state
Used whenAll required steps succeedA failure, validation problem or cancellation occurs
ACID connectionSupports durabilitySupports atomicity
Transaction lifecycle

Transaction States in DBMS

A transaction moves through different states from start to finish. Textbooks may show slightly different diagrams, but these are the common states.

ActiveThe transaction is currently executing read, write or calculation steps.
Partially CommittedThe final statement has executed, but the transaction is not yet safely committed.
CommittedThe transaction completed successfully and its effects are permanent.
FailedThe transaction cannot continue because of an error, crash or rule violation.
AbortedThe DBMS has rolled back the failed transaction and restored a safe state.
TerminatedThe transaction has finished its lifecycle after commit or abort processing.
Pictorial state flow

Transaction State Flow Explained Step by Step

ActiveThe transaction starts and performs operations.
Partially committedIts last statement has executed.
CommittedIf final checks and required recovery steps succeed, changes become permanent.
FailedIf something goes wrong before commit, the transaction enters a failed state.
AbortedThe DBMS rolls back the transaction.
Restart or terminateAn aborted transaction may be restarted in some situations or simply terminated.
SQL transaction example

Simple SQL Transaction Example

START TRANSACTION;

UPDATE accounts
SET balance = balance - 500
WHERE account_id = 101;

UPDATE accounts
SET balance = balance + 500
WHERE account_id = 202;

COMMIT;

If validation fails before commit, the application may execute:

ROLLBACK;

Transaction-start syntax, autocommit behavior and DDL transaction behavior vary across DBMS products. Always follow the documentation of the system you are actually using.

Autocommit concept

What Is Autocommit?

In many DBMS tools and configurations, individual statements may be committed automatically unless an explicit transaction is started or autocommit is disabled.

Autocommit on

Each eligible statement may be treated as its own transaction and committed automatically.

Explicit transaction

Multiple statements are grouped so the application decides when to COMMIT or ROLLBACK.

This matters because a multi-step business action such as a money transfer normally needs all related statements inside one controlled transaction.

What can make a transaction fail?

Common Transaction Failures

Logical errorInvalid input, insufficient balance or violated business rule.
Constraint violationPRIMARY KEY, FOREIGN KEY, CHECK or other database rules reject a change.
System crashPower failure, operating-system crash or DBMS process failure.
Deadlock victimThe DBMS may abort one transaction to break a deadlock.
Application errorProgram logic decides the operation cannot continue safely.
Storage problemI/O or hardware problems may prevent normal completion.
ACID in everyday systems

Real-Life Examples of ACID Properties

SituationACID propertyWhat it means
Bank transferAtomicityDebit and credit should succeed together or be undone.
Inventory never becomes invalidConsistencyRules and constraints remain satisfied.
Two users book at the same timeIsolationConcurrent transactions should not corrupt each other's results.
Payment survives server restartDurabilityA committed result remains after failure.
ACID vs transaction commands

How COMMIT, ROLLBACK and Recovery Connect to ACID

AtomicityRollback and recovery mechanisms help avoid partial transactions.
ConsistencyConstraints plus correct transaction logic protect valid database states.
IsolationConcurrency-control mechanisms coordinate simultaneous transactions.
DurabilityCommit and recovery mechanisms protect committed changes.

ACID properties are goals. The DBMS uses several techniques such as logging, locking, timestamps, MVCC and recovery procedures to provide them.

A common confusion

Transaction vs SQL Statement

SQL Statement

One command such as UPDATE, INSERT or DELETE.

Transaction

One logical unit that may contain one statement or many statements.

Example: one bank transfer transaction may contain two UPDATE statements plus validation queries.

Another common confusion

Consistency vs Isolation

Consistency

Focuses on valid database rules and invariants before and after a successful transaction.

Isolation

Focuses on safe interaction between transactions running at the same time.

A database can have good constraints but still need isolation controls when many users access the same data concurrently.

Bridge to concurrency control

What Happens When Many Transactions Run Together?

Real databases run many transactions concurrently because processing them strictly one by one would reduce performance.

Concurrency creates new problems such as:

Dirty readA transaction reads another transaction's uncommitted data.
Lost updateOne transaction overwrites another transaction's update.
Non-repeatable readThe same row gives different committed values inside one transaction.
Phantom readA repeated condition query sees a changed set of matching rows.

These are handled through isolation levels and concurrency-control methods. That should be the next chapter after transactions.

Connection with earlier DBMS topics

How Transactions Connect to Constraints, SQL and Database Design

Transactions do not work in isolation from the rest of DBMS theory.

Integrity constraintsHelp enforce valid states during transaction execution.
SQL commandsINSERT, UPDATE and DELETE often execute inside transactions.
NormalizationReduces redundancy, which makes transactional updates safer and clearer.
RecoveryRestores correct transaction outcomes after failures.

Revise Normalization in DBMS if you want to connect transaction correctness with clean table design.

Common student mistakes

Transactions and ACID Mistakes to Avoid

Thinking transaction means one SQL statement onlyA transaction can contain multiple statements.
Confusing atomicity with isolationAtomicity is all-or-nothing; isolation is about concurrent transactions.
Thinking consistency means data never changesData can change; it should still satisfy the required rules.
Thinking COMMIT can be undone by normal rollbackAfter commit, ordinary rollback of that transaction is generally no longer available.
Ignoring partially committed stateExecuting the last statement is not always the same as durable commit.
Assuming SAVEPOINT commits dataA savepoint only marks a rollback position inside the transaction.
Assuming all DBMS syntax is identicalTransaction syntax and autocommit behavior vary by product.
Ignoring failure handlingTransactions exist largely to keep the database safe when something goes wrong.
Write according to marks

How to Write Transactions and ACID in Semester Exams

2 marks

Definition

Define a transaction and write the full form of ACID.

5 marks

Explain ACID

Write one or two lines for Atomicity, Consistency, Isolation and Durability with a bank example.

8-10 marks

Full answer

Add transaction states, COMMIT, ROLLBACK, SAVEPOINT, failure handling and a complete bank-transfer example.

For better presentation, use How to Write High-Scoring Answers in University Semester Exams.

Practice with answers

Practice Questions With Answers

1. What is a transaction in DBMS?

A transaction is a sequence of database operations treated as one logical unit of work.

2. What does ACID stand for?

Atomicity, Consistency, Isolation and Durability.

3. What is atomicity?

Atomicity means all operations of a transaction are completed successfully or the incomplete transaction is undone.

4. What is consistency?

Consistency means a successful transaction leaves the database in a state that satisfies the required rules and constraints.

5. What is isolation?

Isolation controls how concurrent transactions interact so they do not produce unacceptable interference.

6. What is durability?

Durability means committed transaction effects survive later failures such as a crash.

7. What is the difference between COMMIT and ROLLBACK?

COMMIT confirms successful changes, while ROLLBACK undoes uncommitted transaction work according to DBMS rules.

8. What is a SAVEPOINT?

A SAVEPOINT marks an intermediate point inside a transaction so partial rollback may be possible.

9. What are the main transaction states?

Common states are Active, Partially Committed, Committed, Failed, Aborted and Terminated.

10. What should I study after transactions and ACID?

Study schedules, serializability, concurrency problems, locking protocols, deadlocks, timestamps and recovery.

60-second revision

Transactions and ACID One-Minute Revision Sheet

TransactionOne logical unit of database work.
AtomicityAll or nothing.
ConsistencyValid state to valid state.
IsolationSafe interaction between concurrent transactions.
DurabilityCommitted changes survive failures.
COMMITConfirm successful changes.
ROLLBACKUndo uncommitted work.
SAVEPOINTIntermediate rollback marker.
ActiveTransaction is executing.
Partially CommittedLast statement executed, final commit not yet secure.
FailedTransaction cannot continue.
AbortedFailed transaction has been rolled back.

Ultimate memory line

Transaction = complete job · ACID = rules that keep that job safe
Frequently asked questions

Frequently Asked Questions

What is a transaction in DBMS in simple words?

A transaction is one complete logical database job, such as transferring money, placing an order or booking a ticket.

What are the ACID properties of a transaction?

The ACID properties are Atomicity, Consistency, Isolation and Durability.

What is atomicity with a real-life example?

In a bank transfer, debit and credit should both happen. If one step fails, the incomplete transfer should be undone.

What is the difference between COMMIT and ROLLBACK?

COMMIT makes successful transaction changes permanent, while ROLLBACK cancels uncommitted changes according to the DBMS transaction rules.

What are transaction states in DBMS?

Common transaction states are Active, Partially Committed, Committed, Failed, Aborted and Terminated.

What should I learn after ACID properties?

Continue with schedules, serializability, concurrency control, locking protocols, deadlocks and recovery techniques.

Next chapter

What Should You Learn Next?

Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Join Telegram Exam updates and free resources