0
What are transactions and ACID properties?
1 Answer
0
A transaction is a sequence of database operations that are executed as a single unit of work. A transaction either completes entirely (commit) or is completely undone (rollback).
ACID Properties
- A — Atomicity: All operations in a transaction succeed or none of them do.
- C — Consistency: The database remains in a valid state before and after the transaction.
- I — Isolation: Concurrent transactions do not interfere with each other.
- D — Durability: Once a transaction is committed, the changes are permanently stored even if the system crashes.
Example
In a bank transfer:
Deduct ₹1000 from Account A.
Add ₹1000 to Account B.
If either step fails, the entire transaction is rolled back to prevent inconsistent data.
One-line interview answer:
"A transaction is a logical unit of work in a database, and ACID ensures transactions are reliable through Atomicity, Consistency, Isolation, and Durability."