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
Atomicity prevents partial updates.
Consistency
Consistency ensures that a transaction:
- Moves the database from one valid state to another
After a transaction:
- All rules are still followed
- Data integrity is maintained
This includes:
- Primary key rules
- Foreign key constraints
- Validation rules
Consistency ensures that:
- Transactions do not break database rules
In IB terms, consistency protects data integrity.
Isolation
Isolation ensures that:
- Transactions do not interfere with each other
When multiple transactions occur at the same time:
- Each one behaves as if it is running alone
This prevents problems such as:
- Reading incomplete data
- Conflicting updates
Isolation is especially important in:
- Multi-user systems
- Online services
IB students should understand isolation as safe concurrent access.
Durability
Durability means that:
- Once a transaction is committed, its results are permanent
Even if:
- The system crashes
- Power fails
- Hardware problems occur
The data remains saved.
Durability is achieved through:
- Logging
- Backups
- Reliable storage
In IB terms, durability ensures long-term data reliability.
Why ACID Properties Matter
Together, the ACID properties ensure that:
- Data remains accurate
- Errors do not corrupt the database
- Systems remain trustworthy
Without ACID:
- Databases could lose data
- Records could become inconsistent
- Users could see incorrect information
This is unacceptable in systems such as:
- Banking
- School records
- E-commerce platforms
Transactions and Real-World Systems
Transactions are used whenever:
- Multiple steps must succeed together
- Data integrity is critical
- Many users access the system simultaneously
IB examiners often link transactions to real-world reliability.
Common Student Mistakes
Students often:
- Memorise ACID without explanation
- Confuse consistency with consistency checking
- Forget why isolation matters
- Describe durability too vaguely
Clear explanations of purpose earn higher marks.
How This Appears in IB Exams
IB questions may ask students to:
- Define a transaction
- Explain one or more ACID properties
- Apply ACID to a scenario
- Justify the use of transactions
Understanding cause and effect is essential.
Final Thoughts
Database transactions ensure that complex operations are completed safely and reliably. The ACID properties work together to prevent errors, protect data integrity, and maintain trust in database systems.
Understanding transactions and ACID allows IB Computer Science students to explain how databases remain reliable in real-world systems — exactly what examiners expect.
