In IB Computer Science, databases are expected to remain reliable even when many users access them at the same time. This reliability is achieved using database transactions. Transactions ensure that data remains accurate, consistent, and secure — even if errors occur.
To explain how transactions work, IB uses the ACID properties: Atomicity, Consistency, Isolation, and Durability. Students are expected to understand what each property means and why it matters, not just memorise the acronym.
What Is a Database Transaction?
A transaction is a sequence of database operations that are treated as one single unit of work.
A transaction must:
- Complete fully
- Or not happen at all
Examples of transactions include:
- Transferring money between accounts
- Updating multiple related records
- Enrolling a student in a course
Transactions protect databases from ending up in incomplete or invalid states.
Atomicity
Atomicity means that a transaction is all or nothing.
Either:
- Every operation in the transaction succeeds
- Or none of them are applied
If any part fails:
- The entire transaction is rolled back
For example:
- If money is removed from one account but cannot be added to another, the removal is undone
