Skip to content

Course home

Structured query language (SQL)

Structured query language (SQL)

EasyMediumHard
1234567
Question 4

A music school rents instruments to pupils who are preparing for their music exams.

Using the relational database shown below, write an SQL query that lists all instrument rentals for pupils who are currently working on Grade 5.

Instrument

InstrumentIDInstrumentType
TR001Trumpet
FL002Flute
VI001Violin
VI002Violin
CL001Clarinet
CL002Clarinet
GT001Guitar

Pupil

PupilIDFirstNameLastNameGradeLevel
MAR004ChloeMarshall3
JON002DavidJones5
ENG001SophieEngel5
PAT001AadyaPatel4
SMI007LoganSmith5
CHE002ChenWei5
OCO003LiamO'Connor2

Rental

RentalIDPupilIDInstrumentIDInsurancePaid
R0001MAR004TR0015.00
R0002OCO003CL0014.50
R0003JON002VI0016.00
R0004ENG001FL0024.50
R0005SMI007GT0017.00
R0006CHE002CL0024.50
R0007PAT001VI0026.00

The query must only return:

  • both physical names of the pupil (first and last)
  • the ID of the rented instrument
  • the insurance paid.

The final results must be sorted in ascending alphabetical order of the pupils' last names.

[6]
Markscheme

Structured query language (SQL) Questions

  1. GCSE
  2. /Computer Science
  3. /Structured query language (SQL)

25 exam-style questions on AQA GCSE Computer Science Structured query language (SQL). Each one has a worked solution and a mark scheme showing where the marks go.

Question bank