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

N5 Computing Science 2022 Question 14

9 marks · Entity-relationship diagrams and keys

Complete the entity relationship diagram below by identifying key attributes. name description dateStarted width hoursTaken length Room Task completed height taskID floor tradesPerson cost(£) name Use the functional requirements above to identify the attribute in the ‘Task’ entity that would be implemented using restricted choice validation. Explain why the General Data Protection Regulations do not apply to the information that will be stored in this database. The relational database is implemented. The data it currently stores is shown below. Room name width length height floor living 4.20 4.05 2.20 ground kitchen 3.25 2.70 2.20 ground dining 3.05 3.10 2.20 ground bedroom 3.70 4.15 2.15 first bathroom 1.80 2.10 2.15 first Task taskID description dateStarted hours Taken completed trades Person cost(£) name 1 Fit new sink 12/4/2022 4 true plumber 98.58 bathroom 2 Paint living room door 12/4/2022 false decorator living 3 Paint kitchen 13/4/2022 3 true decorator 120.00 kitchen 4 Fit kitchen cupboards 15/4/2022 32 true carpenter 1790.00 kitchen 5 Plaster walls 16/4/2022 false plasterer bedroom 6 Fit new bath 16/4/2022 8 true plumber 278.54 bathroom 7 Fit new door to bedroom 18/4/2022 false carpenter bedroom 8 Paint bedroom 18/4/2022 false decorator bedroom A porch is to be built onto the front of the house. The porch is added as a new room by executing the following SQL statement. INSERT INTO Room (name,width,length,height,floor) VALUES ("Porch",1.20,1.40,2.10,"ground"); The task ‘construct porch’ needs to be added. This task was started by a builder on 19 April 2022. The work is not completed so the hours taken and cost are not yet known. Write an SQL statement that will add this work to the Task table. The bedroom is no longer being renovated. The following SQL statements are written to remove the bedroom tasks from the Task table. DELETE FROM Task WHERE taskID = 5; DELETE FROM Task WHERE taskID = 7; DELETE FROM Task WHERE taskID = 8; Write a single efficient SQL statement to remove the bedroom tasks. A property renovation company requires a relational database to store information about the tasks to be carried out on each room of a house. The functional requirements for the database are identified: • Store details of each room in the house. • Store details of each task. • Output a list of tasks carried out by one of the following trades people: electrician, builder, plasterer, decorator, carpenter, plumber. • Output a list of tasks completed for a single room.

Marking scheme

One mark each for • Primary Keys o Room - name o Task - taskID • Foreign Key o Task - name Attributes may be marked in a variety of ways (PK/FK, underlines, asterisk etc) but must be consistent. If two or more attributes on either the Room or Task entities are marked PK, award 0 for the first bullet. If two or more attributes are marked FK, award 0 for the second bullet. tradesPerson Accept “completed”. no personal information is being stored One mark each for • SQL commands correct o INSERT INTO Task o VALUES • Correct 6 fields identified within SQL clause • Correct 6 matching values identified within SQL clause Award 1 mark for the last two bullets if the number of fields matches the number of values but there are more or less than the correct 6 fields and values. taskID must be >= 9 INSERT INTO Task (taskID,description,dateStarted,completed,tradesPerson,name) VALUES (9, “construct porch”, “19/4/2022”, False, “builder”, “Porch”); One mark each for • DELETE FROM Task • WHERE name="bedroom"; Do not award second bullet point for taskID = 5 OR taskID = 7 OR taskID = 8

Previous question: N5 Computing Science 2022 Question 13

Next question: N5 Computing Science 2022 Question 15