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 | |
|---|---|---|
| 1FROM students s | AGives the students table the short name s (an alias) so the rest of the query can use s instead of students | |
| 2JOIN results r ON s.studentId = r.studentId | BThe alias r is used in the ON condition, but it was never created after JOIN results. It should be JOIN results r. | |
| 3After you give a table an alias, use that alias to qualify its columns in the SELECT list | CON s.studentId = r.studentId | |
| 4An alias makes the ON condition shorter than using the full table names | DThe students table was given the alias s, but the SELECT still uses the full name students. Use s.firstName so the alias is used everywhere. | |
| 5SELECT students.firstName, r.mark FROM students s JOIN results r ON s.studentId = r.studentId | EJoins the results table, calls it r, and uses the short names s and r to match the foreign key to the primary key | |
| 6SELECT s.firstName, r.mark FROM students s JOIN results ON s.studentId = r.studentId | FSELECT s.firstName, r.mark |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
FROM students s — Gives the students table the short name s after FROM, so the rest of the query can write s.firstName instead of students.firstName.SELECT s.firstName, r.mark
FROM students s
JOIN results r ON s.studentId = r.studentId;SELECT s.firstName, r.mark
FROM students s
JOIN results r ON s.studentId = r.studentId;SELECT s.firstName, r.mark
FROM students s
JOIN results r ON s.studentId = r.studentId;SELECT s.firstName, r.mark
FROM students s
JOIN results r ON s.studentId = r.studentId;SELECT p.name, o.quantity
FROM orders o
JOIN products p ON o.productId = p.productId;