7. ENTITY RELATIONSHIP MODELLING
Consider an attribute such as full name which is to represent an employee’s complete name. For example, suppose an employee’s name is John McKenzie; the first name is John and the last name is McKenzie. It is easy to appreciate that one user may only need employee last names, and another user may need to display the first name followed by the last name, and yet another user may display the last name, a comma, and then the first name. If it’s reasonable for one to refer to the complete concept of employee name and to its component parts, first name and last name, then we can use a composite attribute. An attribute is composite if it comprises other attributes. To show that an attribute is composite and contains other attributes we show the components as attribute ovals connected to the composite as in:
Attributes can be composite and some of its component attributes may be composite as well (see exercise 3).
1) How would you use a composite attribute to model a phone number.
2) Consider the previous exercise set. Show how we can include room number as a composite attribute that has multiple components.
3) Consider an address attribute. Show that this can be modeled as a multi-level composite attribute where the component attributes include street, city, province, country and where street includes apartment number, street number, street name.