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 | |
|---|---|---|
| 1CREATE VIEW HouseList AS SELECT firstName, house FROM students; | ASaves a query as a virtual table called HouseList that shows only two columns of students | |
| 2SELECT * FROM HouseList; | BCREATE VIEW MarkList AS SELECT s.firstName, r.mark FROM students s JOIN results r ON s.studentId = r.studentId; | |
| 3A view can restrict access by showing only some columns, leaving out private data such as points | CCREATE VIEW StudentNames AS SELECT firstName, lastName FROM students; | |
| 4A view can simplify joins by storing the join once so users do not rewrite the ON condition | DQueries the view as if it were a table, running the stored query to get up-to-date rows | |
| 5CREATE VIEW HouseList SELECT firstName, house FROM students; | EThe AS keyword is missing. CREATE VIEW name must be followed by AS before the SELECT query. | |
| 6CREATE VIEW Top AS INSERT INTO students VALUES (11, 'Zed'); | FA view stores a SELECT query, not an INSERT. The statement after AS must be a SELECT. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
CREATE VIEW — CREATE VIEW makes a view: a stored query shown as a virtual table. It shows chosen data without a second copy, and can restrict access or simplify joins.CREATE VIEW redStudents AS
SELECT firstName, points FROM students
WHERE house = 'Red';CREATE VIEW studentNames AS
SELECT firstName, lastName
FROM students;CREATE VIEW markList AS
SELECT s.firstName, r.mark FROM students s
JOIN results r ON s.studentId = r.studentId;SELECT firstName, points
FROM redStudents
ORDER BY points DESC;CREATE VIEW year7View AS
SELECT firstName, house
FROM students WHERE yearLevel = 7;