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 | |
|---|---|---|
| 1SELECT COUNT(*) FROM results; | ASELECT SUM(price) FROM sales; | |
| 2SELECT MAX(score) FROM results; | BCounts how many rows are in the results table and returns that single number. | |
| 3Add up all the values in a column to get a total | CThe column name is missing brackets. An aggregate function needs brackets around the column, like AVG(score). | |
| 4Use WHERE to work out an average for only some rows | DAVG is stuck on the end of the query. A function must go in the SELECT part, such as SELECT AVG(score), not after WHERE. | |
| 5SELECT AVG score FROM results; | ESELECT AVG(score) FROM results WHERE year = 9; | |
| 6SELECT COUNT(*) FROM results WHERE score > 50 AVG; | FReturns the highest score in the results table. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
SELECT AVG(score) FROM results; — An aggregate function works out one value from many rows. COUNT, SUM, AVG, MIN and MAX give the count, total, mean, lowest and highest. This query returns the mean score.SELECT COUNT(*) FROM results;SELECT SUM(score) FROM results;SELECT AVG(score) FROM results;SELECT MIN(score), MAX(score)
FROM results;SELECT COUNT(*) FROM results
WHERE score > 50;