Data Models, Queries and Integrity
Practise more with these
Picked by meaning from games, worksheets, simulations, teacher tools and videos.
On this sheet
The words and questions from the game
- 1A Students table needs a unique non-null identifier. Which field meets that rule if the system guarantees its uniqueness?An optional nickname · A favourite colour that may repeat · Birth month shared by many students · student_id
- 2A primary key identifies a row under the table’s uniqueness and non-null rules.False · True
- 3An Enrolments row stores student_id referencing Students.student_id. What relationship does that value identify?The associated student · The student's favorite font · The screen colour · The number of keyboards
- 4Circles are enrolments and squares are students. Lines are links. Which picture shows two enrolments linked to one student?
- 5The specified join plan is: read each enrolment’s student_id, find an equal student_id in Students, then output the matching pair. Put the steps in order.
- 6Students contains IDs 1 and 2. Enrolments contains student_id values 1, 1 and 2. How many enrolments refer to student 1?3 · 2 · 0 · 1
- 7Several distinct enrolments may reference the same student when the schema allows it.False · True
- 8A foreign key requires every non-null enrolment student_id to exist in Students. No student has ID 9. What happens if a new enrolment uses student_id 9?Accept ID 9 as an unmatched non-null value. · A matching student is created automatically by definition. · It becomes ID 1. · It is rejected by that constraint.
- 9Circles are enrolments and squares are students. Lines are links. Which picture shows one enrolment linked to two students?
- 10Students has IDs 1 and 2. Enrolments references IDs 1 and 3. An inner join matches equal IDs. How many enrolment rows have a match?1 · 2 · 3 · 0
- 11An inner join includes a child row even when its key has no matching parent.False · True
- 12Listen to the records. Which student has two enrolments?No student · Student 2 · Student 3 · Student 1
- 13A left join starts from all students. Student 3 has no enrolment. What happens to that student in the stated join?The student is removed from the Students table. · The student remains with missing enrolment fields. · Assign another student's enrolment to Student 3. · A real enrolment is invented.
- 14An Enrolments table should contain at most one row per student-course pair. Which constraint directly enforces that rule?A unique constraint on (student_id, course_id) · A colour setting for the table · A unique constraint only on an unrelated display color · A rule that student names need not be unique
- 15A unique student-course pair constraint prevents the same student from enrolling in any other course.True · False
- 16The stated repair plan is: find an invalid reference, verify the source record, then correct a confirmed error. Put the steps in order.
- 17A report joins on student name, but two students share a name. A unique student ID is available in both tables. Which change best targets the duplicate match?Remove every enrolment. · Join on the length of each name. · Join on student ID instead of name. · Join on favourite colour.
- 18Listen to the join counts. How many result rows are described?1 · 2 · 4 · 3
- 19For a left join, COUNT(*) can include a retained unmatched left-side row.True · False
- 20A left join returns one unmatched student row with NULL in e.student_id. What does COUNT(e.student_id) contribute for that row under SQL’s usual non-null counti2 · 0 · 3 · 1
- 21A schema change removes the uniqueness rule on student_id in Students. A join now matches one enrolment to two parent rows with the same ID. What happens to theIt produces two joined rows. · It always produces exactly one joined row. · It produces no joined rows. · It automatically repairs the parent table.
- 22A foreign key and a unique constraint address different integrity properties.True · False
- 23The stated rule forbids deleting a student while matching enrolments exist. What should a delete of such a student do under that rule?Permit the delete while leaving an unmatched reference. · Automatically delete all enrolments without a stated cascade rule. · Replace every student ID with zero. · Reject the delete.
- 24A report uses COUNT(*) after joining students to enrolments. One student has three enrolments. Why can the row count exceed the number of distinct students?Every student necessarily has exactly one enrolment. · Each matching enrolment automatically becomes a new student. · The join can produce multiple rows per student. · COUNT(*) automatically counts distinct students.
- 25A school wants one count per student with at least one enrolment. Which stated query operation directly avoids counting the same non-null student ID more than oCOUNT(*) over every joined row · COUNT(DISTINCT student_id) over the matching rows · SUM(student_id) over all joined rows · Counting the number of columns
About this worksheet
A printable worksheet made from the KiwiBee game “Data Models, Queries and Integrity”. Open it in the free Worksheet Studio to choose the design and the sheet type, then print it or save a PDF.
Design and evaluate stated keys, joins, query counts and integrity constraints.
- ms 267
- computing
- design relations and constraints
- interpret query results
- evaluate an anomaly after a schema change

Comments