ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions

N5 Computing Science 2023 Question 14

11 marks · Entity-relationship diagrams and keys

Each staff member is allocated a number of houses to clean. They clean the windows of the same houses each month. Use the information provided to complete the entity relationship diagram below by: • adding the missing key attribute • drawing the relationship between the entities • naming the relationship between the entities. address houseID customerName House directDebit cost windows staffName Staff contactTel hoursPerWeek staffID The relational database is implemented. Sample data from both tables is shown below. House houseID customerName address directDebit windows cost staffID BON4523 Claire Banks 168 Ferry Place Yes 6 13 1613 DAL8001 Stephen Jones 7F Millbank No 3 7 1752 EDI3189 Ian Collins 15 Robin Ave Yes 8 12 1613 … … … … … … … Staff staffID staffName contactTel hoursPerWeek 2160 Daniel Buchan 07721454187 35 1613 Jessie Tait 07378565190 15 1752 Nick Haig 07745176623 27.5 1617 Dagmara Dyner 07178251143 35 … … … … The database is used to identify all customer names and addresses that have 5 or more windows and are allocated to staff member Fatima Khan. Complete the SQL statement below that would produce this output. SELECT FROM WHERE The owner at 15 Robin Avenue has moved house. The new owner’s name is Sue Horaz. They will still pay via direct debit. Complete the SQL statement below to update this record. UPDATE House SET WHERE houseID = "EDI3189" ; The following details are to be added into the House table. houseID customerName address directDebit windows cost staffID BON9070 Tia Neil 77B Park Close No 5 9 3630 When attempting to add this data, the following error message is displayed. Error - referential integrity! The relationship does not allow this record to be inserted. Explain the reason for this. A window cleaning company wishes to create a database to store information about staff and the houses they clean. The company provides examples of information they would like to include. House houseID: Customer Name: Address: Direct debit: Windows: Cost: Staff staffID: Staff Name: Contact Telephone: Hours Per Week:

Marking scheme

One mark each for: • M-1 relationship • naming the relationship • adding staffID to house entity • FK staffID in house entity See diagram below. One mark for the following SQL code: • SELECT customerName, address • FROM House, Staff • WHERE windows >=5 • AND staffName = "Fatima Khan" • AND House.staffID = Staff.staffID SELECT • fields can be in any order • do not award a mark if additional fields have been included FROM • table names can be in any order WHERE • conditions can be in any order • second/third conditions must include AND customerName = "Sue Horaz" One mark for: • staffID (3630) is not present in the Staff/other table Do not accept ‘referential integrity’ as written in the graphic.

Previous question: N5 Computing Science 2023 Question 13

Next question: N5 Computing Science 2023 Question 15