Question 9

AQA Computer Science Specimen Paper 2 (8525/2)GCSE10 marks

On the specification

9.1
3.7 Relational databases and structured query language (SQL)
9.2
3.7 Relational databases and structured query language (SQL)
9.3
3.7 Relational databases and structured query language (SQL)
9.4
3.7 Relational databases and structured query language (SQL)
Question text

9 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 Pandemic 28/05/19 15 Gormally 1 1 Pandemic 28/05/19 13 Van Perlo 2 1 Terra Mystica 29/05/19 15 Hawkins 2 9.1 State the field in the Booking table that is a foreign key. [1 mark] 9.2 State the most suitable data type to use for the Complexity field. box [1 mark] 9.3 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. [6 marks] 9.4 The LengthOfGame field shows the average amount of time it takes to play a game box 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. [2 marks]