OOPs HandbookACID Properties and Transactions in DBMS: Atomicity, Consistency, Isolation, Durability
DBMSIntermediate
8 min read

ACID Properties and Transactions in DBMS: Atomicity, Consistency, Isolation, Durability

What a transaction guarantees, how databases keep those promises, and the isolation levels interviewers ask about.

TM
TestMeMan SDE Curriculum
Updated Sept 2026
Verified for FAANG Interviews
FROM TESTMEMAN•TestMeMan Campus

Coding problems with instant test-case feedback

Write Python, C++, C or JavaScript in your browser and see which hidden tests pass.

Sponsored Publisher Placement•
ID: ad-top-leaderboard
Executive Summary

A transaction is a group of database operations that must succeed or fail as one unit. Moving ₹500 from account A to account B is two updates; if the system crashes between them, money disappears. ACID is the set of guarantees that prevents this.

1. A transaction in SQL#

Every relational database lets you mark the start and end of a transaction. Until COMMIT, the changes are provisional; ROLLBACK undoes them all.

1BEGIN;
2
3UPDATE accounts SET balance = balance - 500 WHERE id = 'A';
4UPDATE accounts SET balance = balance + 500 WHERE id = 'B';
5
6-- Both rows change together, or neither does
7COMMIT; -- or ROLLBACK; to undo both updates

2. The four properties#

Each letter answers a different "what if" question.

PropertyGuaranteeBank transfer example
AtomicityAll operations happen, or none doA is never debited without B being credited
ConsistencyA transaction moves the database from one valid state to anotherTotal money and constraints like balance ≥ 0 still hold afterwards
IsolationConcurrent transactions do not see each other’s half-done workA report running mid-transfer never sees money "in flight"
DurabilityOnce committed, changes survive crashesAfter the app shows "Transfer successful", a power cut cannot undo it
Sponsored ContentTestMeMan Campus

Practise placement aptitude on the real test pattern

TCS NQT, Infosys, Wipro, Accenture and Cognizant style mocks with section-wise analysis.

3. How databases implement ACID#

Atomicity and durability come from the write-ahead log (WAL). Before a change is applied to the data files, a record of it is written to the log and flushed to disk. After a crash, the database replays committed transactions from the log and undoes uncommitted ones.

Isolation comes from concurrency control: locking (shared locks for reads, exclusive locks for writes, often with two-phase locking) or multi-version concurrency control (MVCC), where readers see a snapshot and never block writers. PostgreSQL and MySQL InnoDB both use MVCC.

Consistency is shared between the database (constraints, foreign keys, triggers) and the application (business rules such as "a transfer cannot exceed the daily limit").

4. Isolation levels and read phenomena#

Full isolation is expensive, so SQL defines weaker levels. Each level allows or prevents three anomalies: a dirty read (reading uncommitted data), a non-repeatable read (the same row returns different values within one transaction) and a phantom read (a repeated query returns new rows).

Isolation levelDirty readNon-repeatable readPhantom read
Read UncommittedPossiblePossiblePossible
Read CommittedPreventedPossiblePossible
Repeatable ReadPreventedPreventedPossible (per the SQL standard)
SerializablePreventedPreventedPrevented
Defaults worth knowing

PostgreSQL defaults to Read Committed; MySQL InnoDB defaults to Repeatable Read. Mentioning that real systems rarely run at Serializable by default shows practical understanding.

Test Your Concept Mastery

Verify your retention on: ACID Properties and Transactions in DBMS: Atomicity, Consistency, Isolation, Durability

Diagnostic Check
Question 1 of 2
Which ACID property ensures a committed transfer survives a power failure?
Question 2 of 2
Reading a row another transaction has changed but not yet committed is called…
Ready for a full proctored assessment?

Take a free aptitude mock on a real company pattern, with a worked solution for every question.

Take an aptitude mock