COMP5320 2025 Wk2 L2 Data Modelling 1 Questions - Tagged
COMP5320 2025 Wk2 L2 Data Modelling 1 Questions - Tagged
Modelling 1
CO M P5 3 2 0 : DATA B A SE SYST E MS
Stefa n Ma rr ( s. ma rr @ ke n t. a c .u k)
Va n es sa B o n thuy s ( v.b o n th u ys @ ke n t. a c. u k)
Ke mi Ad e m o ye ( k. a dem o y e@ ken t .a c. u k)
Acknowledgements: Many thanks to Stefan Marr & Peter Rodgers for lecture notes from previous years.
2
Question 1: Candidate and
Primary Keys
Consider the following Staff entity:
•Identify all candidate keys.
•Select a primary key for the table.
Staff
name
staff_no
dob
address
ni_number
login
salary
3
Question 1: Candidate and Primary Keys
Answer 1
Consider the following Staff entity: • The candidate keys are:
◦ staff_no
• Identify all candidate keys.
◦ ni_number
• Select a primary key for the table. ◦ login
Staff
name • Each member of staff will have a
staff_no unique Staff Number, NI Number, and
dob Login
address ◦ So, any one of these can be used to
ni_number uniquely identify a particular member of
login staff.
salary
4
Question 1: Candidate and Primary Keys
Answer 2
Consider the following Staff entity: • The best choice for the primary key is:
◦ staff_no
• Identify all candidate keys.
• Select a primary key for the table. • While anyone of the candidate keys uniquely
Staff identifies a staff, when choosing primary keys
some general guidelines are that they should:
name ◦ preferably be numeric
staff_no ◦ Should not use attributes that represent personal
dob data and may pose a security risk if shared (both
address Login and NI Number fall into this category).
ni_number
login
• See more guidelines on the lecture slides.
salary
5
Question 2: Multiplicity
Constraints
•The University of Kent has Academic Schools,
e.g., KBS, Computing, etc.
•Schools offer courses to students, e.g.:
◦ In Computing we offer 5 undergraduate courses.
◦ KBS offers 11 undergraduate courses.
6
Question 2: Multiplicity
Constraints
Answer
•The University of Kent has Academic Schools, First some assumptions
e.g., KBS, Computing, etc. •School:
• A school must offer at least one course
•Schools offer courses to students, e.g.: to exist – min: 1
◦ In Computing we offer 5 undergraduate courses.
• A school may offer more than one
◦ KBS offers 11 undergraduate courses. course (Computing offers 5 UG courses)
– max: * (many, more than one)
•Each course is owned by a specific school, •Course:
and a school must offer at least one course. • A course must be owned by a school,
cannot exist on its own – min: 1
•What are the multiplicity constraints of the
following ‘Offers’ relationship? • A course can only be owned by one
school, and not more than one school –
School 1..1 Offers 1..* Course max: 1
Remember we specify the multiplicity constraints for an entity on its opposite side.
7
Additional Practice
Questions
8
Practice Questions
•What is the difference between the candidate key and primary key of a table
(entity)?
•What are the two main requirements of a primary key?
•A staff entity includes the unique attributes: NI Number and Staff ID.
◦ Which attribute is better to use as the primary key, and why?
◦ Why is the other attribute not a good choice?
9
Practice Question: May 2021
Exam
•Consider the following conceptual data model
diagram, which shows a hierarchical relationship.
•It is designed for the personal database of a
collector of coins and banknotes.
•Identify the appropriate coverage properties of
this hierarchy and explain why.
Currency
Banknotes Coins
10
References
•Connolly, T. and Begg, C. (2014). Database Systems:
A Practical Approach to Design, Implementation,
and Management, 6th Edition. Pearson.
•Chapters 10, 12, & 13
11