Question 14

AQA Computer Science June 2023 Paper 2 (8525/2)GCSE12 marks

On the specification

14.1
3.7 Relational databases and structured query language (SQL)
14.2
3.7 Relational databases and structured query language (SQL)
14.3
3.7 Relational databases and structured query language (SQL)
14.4
3.7 Relational databases and structured query language (SQL)
14.5
3.7 Relational databases and structured query language (SQL)
Question text

14 A teacher keeps a record of books loaned to students. box The teacher uses a relational database containing three tables, BookCopy, Student and Loan. Figure 5 shows some data from the tables. Figure 5 BookCopy Student CopyID BookTitle StudentID FirstName LastName YearGroup HT001 HTML 4 Fun TUC004 Barry Tucker 8 PB002 Python Basics WAY002 Shania Wayneton 10 GC001 GCSE Computing KOW001 Bartek Kowalski 11 GC002 GCSE Computing AZE001 Faisal Azeez 9 GC003 GCSE Computing BAK007 Jolene Baker 11 GC004 GCSE Computing ANA002 Aisha Anand 11 GCSE Revision RG001 OKA003 Sani Okafor 10 Guide 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 14.1 Shade two lozenges to show which of the following statements are benefits of relational databases. [2 marks] A All the information can be stored in one table. B Redundant data is less likely to be stored. C Tables don’t need primary keys. D There are less likely to be data inconsistencies. 14.2 State one field in the Loan table that is a foreign key. [1 mark] 14.3 State the most suitable data type for the DepositPaid field in the Loan table. [1 mark] Figure 5 has been included again below. box Figure 5 BookCopy Student CopyID BookTitle StudentID FirstName LastName YearGroup HT001 HTML 4 Fun TUC004 Barry Tucker 8 PB002 Python Basics WAY002 Shania Wayneton 10 GC001 GCSE Computing KOW001 Bartek Kowalski 11 GC002 GCSE Computing AZE001 Faisal Azeez 9 GC003 GCSE Computing BAK007 Jolene Baker 11 GC004 GCSE Computing ANA002 Aisha Anand 11 GCSE Revision RG001 OKA003 Sani Okafor 10 Guide 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 14.4 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. [6 marks] 14.5 Barry Tucker has returned their copy of the book Python Basics. Complete the SQL to delete the loan record for the book PB002. [2 marks] DELETE FROM WHERE 12