ACID: What Makes a Transaction Reliable
Reliable databases promise four properties for transactions, remembered as ACID:
- Atomicity: all the steps happen, or none do.
- Consistency: the data always moves from one valid state to another; constraints are never left broken.
- Isolation: transactions running at the same time do not see each other's half-finished work.
- Durability: once committed, the change survives a crash or power cut.
These guarantees are why banks, shops and hospitals trust relational databases with important records. The example uses a constraint to show atomicity: the failed step leaves no trace.
Examplepython
Quick check
What does the 'D' in ACID promise?
Your turn: write the code
Which ACID property says all steps of a transaction happen or none do? Print its word in lower case.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.