Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1JOIN results ON students.studentId = results.studentId | AFROM students JOIN results ON students.studentId = results.studentId JOIN subjects ON results.subjectId = subjects.subjectId | |
| 2JOIN subjects ON results.subjectId = subjects.subjectId | BThe second JOIN. It follows the foreign key in results to the primary key of subjects to reach the third table. | |
| 3Reaching three tables needs two JOIN lines, one for each link between tables | CSELECT students.firstName, subjects.name, results.mark | |
| 4Once both joins are in place, the SELECT can list fields from the first and third tables, with the junction table in between | DThe first JOIN. It links each student to their rows in the junction table results. | |
| 5JOIN subjects ON students.studentId = subjects.subjectId | EThis ON condition skips the junction table and compares a student ID with a subject ID, which are unrelated keys. It should be results.subjectId = subjects.subjectId. | |
| 6FROM students JOIN results ON students.studentId = results.studentId JOIN subjects | FThe second JOIN has no ON condition, so the keys are never matched. It needs ON results.subjectId = subjects.subjectId. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
JOIN subjects ON results.subjectId = subjects.subjectId — A second JOIN line chained after the first to reach a third table. It follows a foreign key in the junction table to the primary key of the next table.FROM students s
JOIN orders o ON s.studentId = o.studentId
JOIN products p ON o.productId = p.productIdFROM students s
JOIN orders o ON s.studentId = o.studentId
JOIN products p ON o.productId = p.productIdFROM students s
JOIN orders o ON s.studentId = o.studentId
JOIN products p ON o.productId = p.productIdFROM students s
JOIN orders o ON s.studentId = o.studentId
JOIN products p ON o.productId = p.productIdFROM students s
JOIN orders o ON s.studentId = o.studentId
JOIN products p ON o.productId = p.productId