Relational Databases and SQL — AQA GCSE Computer Science
A database stores data in an organised way. A relational database uses linked tables, and SQL is used to query it.
Database basics
- A database is an organised, persistent store of data.
- A flat-file database is a single table, which can lead to data redundancy (repeated data) and inconsistency.
- A relational database uses multiple linked tables, reducing redundancy and improving consistency.
Key terms
- Table — a collection of records about one type of thing (e.g. Students).
- Record (row) — all the data about one item.
- Field (column) — one attribute (e.g. Surname).
- Primary key — a field that uniquely identifies each record.
- Foreign key — a field that links to the primary key of another table, creating a relationship between tables.
SQL (Structured Query Language)
SQL is used to retrieve and manipulate data. Key statements:
- SELECT … FROM … WHERE — retrieve specific data.
e.g.
SELECT Name, Age FROM Students WHERE Age > 15 - ORDER BY — sort the results (ASC or DESC).
- Wildcards and LIKE — search for patterns (e.g.
WHERE Name LIKE 'A%'). - INSERT INTO … VALUES … — add a new record.
- DELETE FROM … WHERE … — remove records.
- UPDATE … SET … WHERE … — change existing data.
You should be able to read, interpret and write SQL statements for given tables.
Exam tips
- Learn the structure: table → record → field, with primary and foreign keys.
- A relational database reduces redundancy compared with a flat file.
- Know the main SQL keywords (SELECT, FROM, WHERE, ORDER BY, INSERT, DELETE, UPDATE).
- Practise writing SELECT … FROM … WHERE queries for sample tables.