Databases and SQL for GCSE Computer Science
GCSE Computer Science, Data. Usually met in years 9 to 11.
Read tables in a relational database and work out what SQL queries return, from a single WHERE to queries across two tables.
What you practise
- Tables, records, fields and keys
- SELECT, FROM, WHERE and ORDER BY
- AND, OR and queries across two tables
Starts with one condition on one table and builds to joining two tables. Practice moves up a level when a round goes well and down when it does not.
Sample questions
Each sample comes with the method and the reason every wrong option is wrong. Real practice rounds are ten questions at your level.
Sample question, level 2 of 5
How many records does this query return?
Pupils
id | name | year | house | score
1 | Ella | 9 | Oak | 75
2 | Hari | 11 | Ash | 60
3 | Dara | 11 | Elm | 40
4 | Omar | 10 | Ash | 90
5 | Chen | 9 | Oak | 55
6 | Jay | 9 | Oak | 50
SELECT name, score FROM Pupils
WHERE score > 50
- 1
- 6
- 5
- 3
- 4
Show the answer and method
Answer: E, 4
The method: Scores greater than 50: 75, 60, 90, 55. That is 4.
Why the other options are wrong:
- A, 1: That counts the scores below 50.
- B, 6: Count the matching scores again.
- C, 5: > does not include 50 itself; that would be >=.
- D, 3: Close, but check your working: this is a small slip away from the answer.
Sample question, level 4 of 5
Which term means: the SQL keyword that sets the condition records must meet?
- Query
- Relationship
- Entity
- DESC
- WHERE
Show the answer and method
Answer: E, WHERE
The method: WHERE means the SQL keyword that sets the condition records must meet.
Why the other options are wrong:
- A, Query: Query means a request to find or change data in a database.
- B, Relationship: Relationship means a link between two tables, made with a primary key and a foreign key.
- C, Entity: Entity means a thing, such as a pupil or a book, about which data is stored in a table.
- D, DESC: DESC means sorting from largest to smallest, or from Z to A.
See where this fits: every GCSE option topic and Key Stage 3.
Related topics: Binary, Hexadecimal, Units and file sizes, Characters and compression.