Referential integrity
Every foreign key value must match an existing primary key in the related table, so no record points to something missing. The database blocks changes that break this.
Understanding Referential integrity in ACARA Digital Technologies Years 9–10
What it does: This shows the rule: each studentId in orders (foreign key) must be found in students (primary key). The order points to a student who is missing, which is an orphan. Referential integrity exists to prevent this. An orphan record has a foreign key value that matches no primary key in the related table. The database blocks the invalid change, because the foreign key would not match any primary key. Handle the child records (the orders) first so no orders are left pointing at a missing customer.
Common mistakes: Customer 7 does not exist, so this order would be an orphan record and the database blocks it. The custId must match an existing customer, such as 1. The foreign key belongs in the orders table, the many side that points to customers. It should be ALTER TABLE orders.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 433–451) and word search (Modules 413–451).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
referential integrityFill in the Blanks
Spot the Error
Student with a class code? Join your class →