You're connected to a database, and each question asks you to find something out by writing an SQL query. Your queries run on your own copy of the database, in your browser, so try anything: you can't break it.
- SELECT the columns you want, FROM the table, WHERE a condition is true, then ORDER BY a column, ASC (smallest or earliest first) or DESC (largest or latest first).
- Join conditions with AND (both must be true) or OR (either can be). Text values go in quotation marks, spelt exactly as in the table:
WHERE Artist = 'Queen'.
- COUNT(*) counts the rows, and SUM(column) adds up a column.
Some questions show a query and ask what it outputs instead. Questions marked AS go beyond IGCSE: AVG, MIN, MAX, LIKE (with % standing for any characters) and GROUP BY.
Checking. Your query is run and its result is compared with the right answer's, so any query that gives the right rows is right, whatever its column names. When a question asks for an order, your rows must be in that order too. If it's not right, you're told what's different, and you can try again; Show the answer gives a query that works. Explore, in the title bar, lets you run any query on the database, unchecked.
Mysteries. A mystery is a case to solve with several tables of evidence: join them (INNER JOIN), count and add them up (GROUP BY, COUNT, SUM), and keep your own list of suspects, with CREATE TABLE, ALTER TABLE, INSERT INTO, UPDATE and DELETE FROM, as in Cambridge AS 9618. The evidence can't be changed, but your own tables can. Each step is checked against your database; everything you change is kept, so you can stop and carry on, or start the case again.
Signed in, your queries are saved: come back and carry on. A question counts once you've got it right without being shown the answer. Questions your teacher has set are marked, and come up first.
Objective: read, understand and complete SQL scripts to query data stored in a single database table (Cambridge IGCSE Computer Science 0478, 9.4), and write SQL to query data (9618 8.3).