AQA GCSE Computer Science 3.7 Relational databases and SQL: tables, keys and writing queries
A deep-dive AQA GCSE Computer Science guide to area 3.7 Relational databases and SQL. Covers database concepts (tables, records, fields, primary and foreign keys) and writing SQL queries with SELECT, FROM, WHERE and ORDER BY, plus INSERT, UPDATE and DELETE, with the query-writing skills Paper 2 rewards.
Reviewed by: AI editorial process; not yet individually human-reviewed
What area 3.7 actually demands
Relational databases and SQL is a small but practical area examined in Paper 2. You must understand how a relational database is structured and be able to write SQL queries to read and change data. The marks reward correct, well-formed queries and precise use of the database terms, so the area rewards practice rather than memorising prose.
This guide ties together the two dot-point pages for the area.
Database concepts
A relational database stores data in tables. Each table holds records (rows, one per item) and fields (columns, one per attribute). A primary key is a field that uniquely identifies each record, and a foreign key is a field in one table that holds the primary key of another table, linking the two. Organising data into related tables avoids redundancy (storing the same data many times) and keeps it consistent.
Writing SQL
SQL (Structured Query Language) is the language used to work with the database. A retrieval query uses SELECT (which fields), FROM (which table), WHERE (an optional condition to filter records) and ORDER BY (to sort the results). To change data you use INSERT (add a record), UPDATE (change existing records) and DELETE (remove records). Remember that UPDATE and DELETE need a WHERE clause, or they affect every record, and that text values need quotation marks.
Check your knowledge
A mix of recall and query-writing questions covering area 3.7. Attempt them, then check against the solutions.
- State the difference between a record and a field. (2 marks)
- State what a primary key is. (2 marks)
- Explain how a foreign key links two tables. (2 marks)
- State one reason data is split across related tables. (1 mark)
- Name the SQL keyword used to sort query results. (1 mark)
- Write an SQL query to return all fields of every record in a table called Books. (2 marks)
- Write an SQL query to return the title of every book published after 2000. (3 marks)
- State what the UPDATE statement does and why it usually needs a WHERE clause. (2 marks)
Sources & how we know this
- AQA GCSE Computer Science (8525) specification — AQA (2020)