lesson
Related changes should succeed together
1 · Learn
A transaction groups related database changes so they can commit together or roll back when the operation fails, under the database's guarantees. This helps avoid a half-completed operation leaving inconsistent records.
A transaction is not a substitute for validation, correct permissions or a backup. External actions such as sending a message may need separate coordination because they cannot always be rolled back with database rows.
2 · Worked example
Creating an enrolment and reserving its limited place should not leave only one of those changes if they must stay consistent.
3 · Your turn
What problem arises if a place is reserved but the required enrolment record is not created?
Check your answer
The system's related records disagree, potentially consuming a place without a corresponding enrolment.
4 · Apply your learning
Trace a fictional operation with a failure between steps and identify which changes must be atomic.
Adult guidance and safety
Use an approved sandbox, invented data and test accounts. Do not probe other systems or expose credentials. Retain test evidence and accessibility checks; these teaching models are not a completed practical project or a specified GCSE qualification.
Practice this lesson
Lesson resources
Browse the available practice activities and worksheets for this lesson.