ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions
15 marks · Entity-relationship diagrams and keys
Complete the table below to identify the keys that were created when this relational database was implemented. Table Field Primary Key Primary Key Foreign Key State the attribute type that would be most suitable for the following fields. walkDay minutesTaken Design a query that would find the routeID of all the Mountain routes with a rating of 3 or more. Search criteria Field(s) Table(s) Read the SQL statement below. SELECT start, routeType, minutesTaken FROM Route, Walk WHERE Route.routeID = Walk.routeID AND rating = 2; Complete the table below to show the expected output from this SQL statement. routeType start minutesTaken Describe how to evaluate the accuracy of the expected output from an SQL statement. The database was implemented without referential integrity. Describe a problem that may occur when adding a new record to the ‘Walk’ table. A database stores information about a walking club. The table ‘Route’ stores all the available routes. The table ‘Walk’ stores information when one of these routes is completed. Part of the information stored in each table is shown below. Route routeID start finish estimatedMins Kms routeType rating 1 Shiel Bridge Glen More 480 23 Mountain 5 2 Aberdour Anstruther 600 44 Coastal 4 3 Rackwick Rackwick 180 12 Coastal 2 4 Kelty Loch Glow 90 5 Forest 1 5 Fort William Steall Falls 210 8 Hill 4 6 Pitlochry Blair Atholl 175 11 Forest 2 Walk walkNumber walkDay departure numberWalkers rained minutesTaken routeID 1893 21/03/17 09:00 9 Yes 213 3 2002 30/04/17 07:30 15 No 167 3 0019 27/11/14 11:10 30 No 606 2 0218 01/02/16 13:30 3 No 102 4 0723 16/10/15 02:00 12 Yes 713 2 0086 01/01/15 08:45 24 Yes 180 6 1992 05/04/17 13:00 2 No 512 1 0499 19/11/15 14:00 9 No 190 5
One mark for each correct row: Primary Key Primary Key Foreign Key Table Field Route routeID Walk walkNumber Walk routeID Order of first two rows is not important. One mark each for: • date • number/numeric Field(s) routeID (1) Table(s) Route (1) Search criteria routeType = Mountain (1) AND (1) rating >= 3 (1) Accept search criteria rating > 2 One mark for each correct row: start routeType minutesTaken Rackwick Coastal 213 Rackwick Coastal 167 Pitlochry Forest 180 Order of rows is not important. The SQL statement could be run and the output compared to what was expected. Any one from: • a walk could be added to the table that does not have a matching route ID so the data would not be linked with the route table • adding a new record to the Walk table which does not link to any existing record in the Routes table • data could be added that would potentially affect the results of future queries.