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 top_students AS SELECT firstName, points FROM students WHERE points > 100; | ASaves the SELECT query under the name top_students so it can be used like a table | |
| 2DROP VIEW top_students; | BDeletes the saved view but leaves the original table data untouched | |
| 3A view can hold a join, so students can query results from two tables as if they were one table | CThe AS keyword is missing. CREATE VIEW must be followed by the view name, then AS, then the SELECT query. | |
| 4Once a view exists, you query it with SELECT FROM the view name, just like a table | DDROP TABLE is used to remove a view. A view must be removed with DROP VIEW, otherwise the command fails because top_students is not a table. | |
| 5CREATE VIEW top_students SELECT firstName, points FROM students; | ESELECT * FROM student_marks WHERE mark > 80; | |
| 6DROP TABLE top_students; | FCREATE VIEW student_marks AS SELECT s.firstName, r.mark FROM students s JOIN results r ON s.studentId = r.studentId; |
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 under a name so you can query it like a table. A view stores the query, not a copy of the data, so it always shows current rows. Remove it with DROP VIEW.CREATE VIEW highMarks AS
SELECT studentId, mark FROM results
WHERE mark >= 80;CREATE VIEW year7 AS
SELECT firstName, house FROM students
WHERE yearLevel = 7;CREATE VIEW studentMarks AS
SELECT s.firstName, r.mark FROM students s
JOIN results r ON s.studentId = r.studentId;SELECT firstName, mark FROM studentMarks
WHERE mark > 90;DROP VIEW studentMarks;