Fundamentals · Medium · Free
Explain ACID properties with a bank transfer example.
FresherFundamentalsDatabase Fundamentals
ACID transfer
| Property | Meaning | Failure |
|---|---|---|
| Atomicity | All or nothing | Money vanishes |
| Consistency | Rules hold | Negative balance |
| Isolation | Concurrent txs safe | Dirty reads |
| Durability | Survives crash | Lost commit |
sql
BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;Story beats acronym recitation.