Relational Databases (AQA GCSE Computer Science)

Exam Questions

35 mins9 questions
11 mark

A relational database is being developed to store information about the games that are box available to play at a games café and the advance bookings that have been made for those games. Each game has a unique name.

The database contains two tables: Game and Booking.

The database is currently being tested by the person who has developed it so the database tables only contain a small amount of data that is being used for testing.

The contents of the tables are shown in Figure 5.

Figure 5

Table listing board games with columns for name, minimum and maximum players, game length, and complexity rating for five different games.
Table of game bookings with columns: GameTableID, Name, Date, StartTime, Customer, and Hours. Includes five entries from 28/05/19 to 29/05/19.

State the most suitable data type to use for the Complexity field.

Did this page help you?

21 mark

A teacher keeps a record of books box loaned to students.

The teacher uses a relational database containing three tables, BookCopy, Student and Loan. Figure 5 shows some data from the tables.

Figure 5

Library database image showing tables: BookCopy, Student, and Loan, detailing book titles, student names and IDs, loan details, and deposit paid.

State the most suitable data type for the DepositPaid field in the Loan table

Did this page help you?

3a1 mark

A relational database box has been developed for a youth club to store information about their members and the awards they are given.

The database contains two tables: Member and Award

Figure 4 shows some data from the tables.

Figure 4

Two tables: Members with ID, first name, last name, date joined; Awards with ID, member ID, date presented, award name.

State one benefit of using relational databases.

3b1 mark

State the name of the field from the Member table that is the most suitable to use as the primary key.

3c1 mark

State the name of the field from the Award table that is a foreign key.

Did this page help you?

11 mark

A relational database is being developed to store information about the games that are box available to play at a games café and the advance bookings that have been made for those games. Each game has a unique name.

The database contains two tables: Game and Booking.

The database is currently being tested by the person who has developed it so the database tables only contain a small amount of data that is being used for testing.

The contents of the tables are shown in Figure 5.

Figure 5

Game

Name

MinPlayers

MaxPlayers

LengthOfGame

Complexity

Friday

1

1

25

2.12

Scythe

1

5

90

3.37

Terra Mystica

2

5

100

3.95

Agricola

1

4

90

3.31

Pandemic

2

4

45

2.42

Booking

GameTableID

Name

Date

StartTime

Customer

Hours

1

Friday

28/05/19

11

Hawkins

1

2

Scythe

28/05/19

11

Jemisin

1

3

Terra Mystica

28/05/19

15

Gormally

1

1

Agricola

28/05/19

13

Van Perlo

2

1

Pandemic

28/05/19

15

Hawkins

2

State the field in the Booking table that is a foreign key.

Did this page help you?

2a2 marks

A teacher keeps a record of books box loaned to students.

The teacher uses a relational database containing three tables, BookCopy, Student and Loan. Figure 5 shows some data from the tables.

Figure 5

BookCopy

CopyID

BookTitle

HT001

HTML 4 Fun

PB002

Python Basics

GC001

GCSE Computing

GC002

GCSE Computing

GC003

GCSE Computing

GC004

GCSE Computing

RG001

GCSE Revision Guide

Student

StudentID

FirstName

LastName

YearGroup

TUC004

Barry

Tucker

8

WAY002

Shania

Wayneton

10

KOW001

Bartek

Kowalski

11

AZE001

Faisal

Azeez

9

BAK007

Jolene

Baker

11

ANA002

Aisha

Anand

11

OKA003

Sani

Okafor

10

Loan

LoanID

StudentID

CopyID

DepositPaid

L0001

TUC004

HT001

0.50

L0002

WAY002

GC004

2.00

L0003

KOW001

GC001

2.00

L0004

TUC004

PB002

0.75

L0005

BAK007

RG001

2.50

L0006

BAK007

GC002

2.00

L0007

OKA003

GC003

2.00

Identify two choices to show which of the following statements are benefits of relational databases.

  • All the information can be stored in one table

  • Redundant data is less likely to be stored

  • Tables don’t need primary keys.

  • There are less likely to be data inconsistencies.

2b1 mark

State one field in the Loan table that is a foreign key.

2c2 marks

Figure 5 has been included again below

Figure 5

BookCopy

CopyID

BookTitle

HT001

HTML 4 Fun

PB002

Python Basics

GC001

GCSE Computing

GC002

GCSE Computing

GC003

GCSE Computing

GC004

GCSE Computing

RG001

GCSE Revision Guide

Student

StudentID

FirstName

LastName

YearGroup

TUC004

Barry

Tucker

8

WAY002

Shania

Wayneton

10

KOW001

Bartek

Kowalski

11

AZE001

Faisal

Azeez

9

BAK007

Jolene

Baker

11

ANA002

Aisha

Anand

11

OKA003

Sani

Okafor

10

Loan

LoanID

StudentID

CopyID

DepositPaid

L0001

TUC004

HT001

0.50

L0002

WAY002

GC004

2.00

L0003

KOW001

GC001

2.00

L0004

TUC004

PB002

0.75

L0005

BAK007

RG001

2.50

L0006

BAK007

GC002

2.00

L0007

OKA003

GC003

2.00

Barry Tucker has returned their copy of the book Python Basics.

Complete the SQL to delete the loan record for the book PB002.

DELETE FROM .............................

WHERE ...................................

Did this page help you?

3a2 marks

Define the term relational database

3b2 marks

Figure 4

Member

MemberID

FirstName

LastName

DateJoined

1

Zarah

Tariq

2020-01-05

2

Penny

Hill

2020-01-05

3

Peter

Boyes

2020-02-14

4

Reuben

Bailey

2020-10-20

Award

AwardID

MemberID

DatePresented

AwardName

1

1

2020-09-10

Teamwork

2

1

2020-10-13

Outdoors

3

3

2020-06-19

Challenge

4

2

2020-11-11

Leader

A new member joins the youth club. The following SQL is run to add their details to the database:

INSERT INTO circle enclose bold A
circle enclose straight B (5, 'Alina', 'Ahmed', '2020-11-30')

Some of the SQL has been replaced by labels.

State the SQL that should have been written in place of the labels circle enclose straight A and circle enclose straight B

Did this page help you?

1a6 marks

A relational database is being developed to store information about the games that are box available to play at a games café and the advance bookings that have been made for those games. Each game has a unique name.

The database contains two tables: Game and Booking.

The database is currently being tested by the person who has developed it so the database tables only contain a small amount of data that is being used for testing.

The contents of the tables are shown in Figure 5.

Figure 5

Game

Name

MinPlayers

MaxPlayers

LengthOfGame

Complexity

Friday

1

1

25

2.12

Scythe

1

5

90

3.37

Terra Mystica

2

5

100

3.95

Agricola

1

4

90

3.31

Pandemic

2

4

45

2.42

Booking

GameTableID

Name

Date

StartTime

Customer

Hours

1

Friday

28/05/19

11

Hawkins

1

2

Scythe

28/05/19

11

Jemisin

1

3

Terra Mystica

28/05/19

15

Gormally

1

1

Agricola

28/05/19

13

Van Perlo

2

1

Pandemic

28/05/19

15

Hawkins

2

Due to a change in layout at the café, the Game table with an ID of 2 is no longer suitable for games that can have more than four players. The manager needs to find out the customer, date and time of all bookings made for the game table with an ID of 2 that are for a game that can have more than four players.

Write an SQL query that could be used to find this information for the manager. The results should be shown in date order.

1b2 marks

The LengthOfGame field shows the average amount of time it takes to play a game in minutes.

A query to add 10 minutes to the length of time taken for all games that have a Complexity of more than three is shown in Figure 6.

Figure 6

UPDATE Game
SET LengthOfGame = LengthOfGame + 9
WHERE Complexity <= 3

The query contains two errors.

Refine the query in Figure 6 to correct the errors.

Did this page help you?

26 marks

Figure 5

BookCopy

CopyID

BookTitle

HT001

HTML 4 Fun

PB002

Python Basics

GC001

GCSE Computing

GC002

GCSE Computing

GC003

GCSE Computing

GC004

GCSE Computing

RG001

GCSE Revision Guide

Student

StudentID

FirstName

LastName

YearGroup

TUC004

Barry

Tucker

8

WAY002

Shania

Wayneton

10

KOW001

Bartek

Kowalski

11

AZE001

Faisal

Azeez

9

BAK007

Jolene

Baker

11

ANA002

Aisha

Anand

11

OKA003

Sani

Okafor

10

Loan

LoanID

StudentID

CopyID

DepositPaid

L0001

TUC004

HT001

0.50

L0002

WAY002

GC004

2.00

L0003

KOW001

GC001

2.00

L0004

TUC004

PB002

0.75

L0005

BAK007

RG001

2.50

L0006

BAK007

GC002

2.00

L0007

OKA003

GC003

2.00

Year 11 students must return their books after they have finished their GCSE exams.

Using the database shown in Figure 5, write an SQL query that lists all the loans for students who are in Year 11.

The query must only return:

  • both names of the student

  • the ID of the book borrowed

  • the deposit paid.

The results must be in ascending order of the students’ last names.

Did this page help you?

36 marks

A relational database box has been developed for a youth club to store information about their members and the awards they are given.

The database contains two tables: Member and Award

Figure 4 has been included below.

Figure 4

Member

MemberID

FirstName

LastName

DateJoined

1

Zarah

Tariq

2020-01-05

2

Penny

Hill

2020-01-05

3

Peter

Boyes

2020-02-14

4

Reuben

Bailey

2020-10-20

Award

AwardID

MemberID

DatePresented

AwardName

1

1

2020-09-10

Teamwork

2

1

2020-10-13

Outdoors

3

3

2020-06-19

Challenge

4

2

2020-11-11

Leader

The youth club needs to produce a report listing the members who have been given the Leader award. The report must include both names of each member and the date the award was presented.

Write an SQL query that could be used to find this information. The results must be in order of the date the awards were presented, starting with the earliest.

Did this page help you?