Skip to content
Educator
GCSE Computer Science

Relational Databases and SQL

91 questions11 subtopicsAQAOCR
Practise all 91 questions free →

What's covered

SQL: SELECT, FROM, WHERE14
Queries Across Two Tables10
Table, Record, Field, Data Type9
Avoiding Data Inconsistency and Redundancy8
Concept of a Relational Database8
SQL: UPDATE8
Concept of a Database7
SQL: DELETE FROM7
SQL: INSERT INTO7
SQL: ORDER BY (ASC / DESC)7
Primary Keys and Foreign Keys6

Key facts

1

Avoiding Data Inconsistency and Redundancy

The best way to avoid storing a customer's address twice is to store the address once in a Customers table and link to it from Orders via a foreign key.

2

Concept of a Database

A database is an organised collection of data.

3

Concept of a Relational Database

A flat-file database stores all data in a single table (or file) without explicit links to other tables.

4

Primary Keys and Foreign Keys

A foreign key is a field in one table that holds the primary key value of a record in another table, used to link the two.

5

Queries Across Two Tables

In AQA-style GCSE SQL, two tables are joined using a WHERE clause that matches the key fields: ... FROM A, B WHERE A.id = B.a_id.

6

SQL: DELETE FROM

DELETE FROM removes records (rows) from a database table.

7

SQL: INSERT INTO

INSERT INTO Books (title, year) VALUES ('Hamlet', 1603) adds a new row to the Books table.

8

SQL: ORDER BY (ASC / DESC)

ASC stands for ascending order: smallest to largest, or A→Z for text.

9

SQL: SELECT, FROM, WHERE

The core SQL data-manipulation commands are: SELECT (retrieve data from a table), INSERT INTO (add a new record), UPDATE (change data in existing records), and DELETE FROM (remove records).

10

SQL: UPDATE

The SET clause specifies the new field values to assign.

Practice questions with answers

A taste of the 91 questions in this topic, answers marked. Sign up to practise the full set with spaced repetition.

1Avoiding Data Inconsistency and Redundancy

What is data redundancy?

  • •Data stored across multiple tables using foreign keys
  • •Data that has been encrypted and backed up
  • •Missing values in a database record
  • ✓Same data stored more than once
2Concept of a Database

Why use a database instead of separate files?

  • •Always smaller in size than text files
  • ✓Better organised and easier to query
  • •Removes the need for storage devices
  • •Runs much faster than the CPU only
3Concept of a Relational Database

What is the main advantage of a relational database?

  • ✓Reduces data duplication across tables
  • •Removes the need for primary keys
  • •Runs queries entirely without indexes
  • •Stores every record in just one table
4Primary Keys and Foreign Keys

Why use a foreign key?

  • •To compress data in the database file
  • ✓To link records across two tables
  • •To remove the need for primary keys
  • •To store random keys in each record
5Queries Across Two Tables

What links two tables in a relational query?

  • •A common SQL alias
  • ✓A matching foreign key
  • •A shared table name
  • •An identical column data type
6SQL: DELETE FROM

Which SQL removes Sam from Students?

  • ✓DELETE FROM Students WHERE name = 'Sam'
  • •DELETE Sam FROM Students table now
  • •DROP Students WHERE name = 'Sam' only
  • •REMOVE FROM Students WHERE name = 'Sam'

Three minutes a day. Knowledge that sticks.

Practise all 91 Relational Databases and SQL questions with spaced repetition, so what you revise today is still there in the exam. Free to use, no card needed.

More GCSE Computer Science topics

📖 All GCSE Computer Science key terms & vocabulary →