ExamBank Scot · AH Computing Science question bank · All AH Computing Science questions
5 marks · Entity-relationship diagrams
Draw the entity‑relationship diagram for the university accommodation rental system. Your diagram should clearly indicate: • the cardinality of each relationship • the relationship participation for each entity • whether each entity is strong or weak. Describe a potential problem with the primary key of the Student entity and suggest how this problem could be resolved. A relational database system is being designed for a university to manage rentals for on‑campus accommodation in three accommodation blocks: Clyde House, Hebridean Place, Lothian Way. The system will store rental details in three separate tables: Student, Accommodation and Rental. Sample data to be stored in these tables is shown below. Student studentID firstName surnameName email courseID SJME3456 Stephanie Jones stephanie@zmail.com ME3456 JRCS4455 James Ritchie jgritchie@coldmail.com CS4455 … … … … … Accommodation accomID accomBlock costPerMonth HEB24 Hebridean Place 450 CLY56 Clyde House 425 LOT24 Lothian Way 475 … … … Rental startDate endDate studentID accomID 03/09/2022 17/12/2022 SJME3456 CLY56 17/09/2022 28/05/2023 JRCS4455 HEB24 … … … … The following constraints apply to the university accommodation rental system: • the system being developed will only store details of students who rent on‑campus accommodation • all accommodation is identified by a unique accommodation ID • all students are identified by a unique student ID formed by concatenating the student’s initials with their courseID • accommodation that is being refurbished is not available for rental.
See answer below Award 1 mark for weak/strong entities correct Award 1 mark for correct relationship participation between Student and Rental Award 1 mark for correct relationship participation between Rental and Accommodation Note: do not penalise cardinality Note: accept double-edged box as indication of weak entity. The key values are formed by combining a student’s initials and their courseID. If a student changes their name (or course) at some point in the future, the primary key values would need to be updated accordingly. Also, if two students on the same course have the same initials, this will be problematic. This can be resolved by adding a surrogate key that stores an auto generated integer value as details of a student are added the Student table. Award 1 mark for description of problem resulting from the need to update the primary key values at some point in the future. Award 1 mark for identifying that a surrogate key could be used to resolve the problem. Accept adding a new field that makes use of auto increment and making that the primary key field, while still retaining the data listed in the studentID field.