1.
The teacher uses a relational database containing three tables, BookCopy, Student and Loan.
The figure below shows some data from the tables.
BookCopy Student
Loan
(Total 2 marks)
BookCopy Student
Loan
_______________________________________________________________________
(Total 1 mark)
BookCopy Student
Loan
State the most suitable data type for the DepositPaid field in the Loan table.
_______________________________________________________________________
_______________________________________________________________________
(Total 1 mark)
BookCopy Student
Loan
Using the database shown in the figure above, write an SQL query that lists all the loans for
students who are in Year 11.
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
(Total 6 marks)
BookCopy Student
Loan
Barry Tucker has returned their copy of the book Python Basics.
Complete the SQL to delete the loan record for the book PB002.
WHERE _________________________________________________________________
(Total 2 marks)
Member
Award
1 1 2020-09-10 Teamwork
2 1 2020-10-13 Outdoors
3 3 2020-06-19 Challenge
4 2 2020-11-11 Leader
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
(2)
___________________________________________________________________
___________________________________________________________________
(1)
___________________________________________________________________
___________________________________________________________________
(1)
(d) State the name of the field from the Award table that is a foreign key.
___________________________________________________________________
___________________________________________________________________
(1)
Member
Award
1 1 2020-09-10 Teamwork
2 1 2020-10-13 Outdoors
3 3 2020-06-19 Challenge
4 2 2020-11-11 Leader
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.
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
(6)
(f) A new member joins the youth club. The following SQL is run to add their details to the
database:
INSERT INTO
(5, 'Alina', 'Ahmed', '2020-11-30')
State the SQL that should have been written in place of the labels and .
_______________________________________________________________
_______________________________________________________________
(2)
(Total 13 marks)
A relational database is being developed to store information about the games that are available
7. 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 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.
Friday 1 1 25 2.12
Scythe 1 5 90 3.37
Agricola 1 4 90 3.31
Pandemic 2 4 45 2.42
Booking
(a) State the field in the Booking table that is a foreign key.
___________________________________________________________________
___________________________________________________________________
(1)
(b) State the most suitable data type to use for the Complexity field.
___________________________________________________________________
___________________________________________________________________
(1)
(Total 2 marks)
Write an SQL query that could be used to find this information for the manager. The results
should be shown in date order.
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
(Total 6 marks)
The LengthOfGame field shows the average amount of time it takes to play a game in minutes.
9.
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 below.
UPDATE Game
The query contains two errors. Refine the query to correct the errors.
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
(Total 2 marks)
Dubai College Page 12 of 12