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.
| InstrumentID | InstrumentType |
|---|---|
| TR001 | Trumpet |
| FL002 | Flute |
| VI001 | Violin |
| VI002 | Violin |
| CL001 | Clarinet |
| CL002 | Clarinet |
| GT001 | Guitar |
| PupilID | FirstName | LastName | GradeLevel |
|---|---|---|---|
| MAR004 | Chloe | Marshall | 3 |
| JON002 | David | Jones | 5 |
| ENG001 | Sophie | Engel | 5 |
| PAT001 | Aadya | Patel | 4 |
| SMI007 | Logan | Smith | 5 |
| CHE002 | Chen | Wei | 5 |
| OCO003 | Liam | O'Connor | 2 |
| RentalID | PupilID | InstrumentID | InsurancePaid |
|---|---|---|---|
| R0001 | MAR004 | TR001 | 5.00 |
| R0002 | OCO003 | CL001 | 4.50 |
| R0003 | JON002 | VI001 | 6.00 |
| R0004 | ENG001 | FL002 | 4.50 |
| R0005 | SMI007 | GT001 | 7.00 |
| R0006 | CHE002 | CL002 | 4.50 |
| R0007 | PAT001 | VI002 | 6.00 |
The query must only return:
The final results must be sorted in ascending alphabetical order of the pupils' last names.
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.