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 houseRed AS SELECT firstName, points FROM students WHERE house = 'Red'; | ACREATE TABLE makes a real table with its own copy of the data, not a view. A view needs CREATE VIEW. | |
| 2SELECT * FROM houseRed; | BCREATE VIEW studentNames AS SELECT studentId, firstName FROM students; | |
| 3A view can hide sensitive columns by leaving them out of its SELECT list. | CThe AS keyword is missing. CREATE VIEW name must be followed by AS before the SELECT query. | |
| 4A view is not a table: it stores a query, not a copy of the data, so removing the view leaves the original table untouched. | DQueries the saved view houseRed just like a table, running its stored SELECT each time to give the current rows. | |
| 5CREATE VIEW topStudents SELECT firstName, points FROM students WHERE points > 100; | EDROP VIEW studentNames; | |
| 6CREATE TABLE topStudents AS SELECT firstName, points FROM students; | FSaves a query as a virtual table named houseRed that shows only the first name and points of Red house students. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
CREATE VIEW — Saves a SELECT query as a named virtual table. It shows chosen columns and rows, can hide others, and stores no copy of the data, so you query it like a table.CREATE VIEW redHouse AS
SELECT firstName, points
FROM students WHERE house = 'Red';CREATE VIEW year7 AS
SELECT firstName, lastName
FROM students WHERE yearLevel = 7;-- view: topStudents
SELECT * FROM topStudents
WHERE points > 100;CREATE VIEW names AS
SELECT firstName, lastName
FROM students;CREATE VIEW blueHouse AS
SELECT firstName, points FROM students
WHERE house = 'Blue';