25-Comp-B3 Data Bases and File Systems · December 2013
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.
Approach. Model each business rule as an entity, a relationship, or a cardinality/participation annotation, choosing entity vs. attribute so that every stated constraint becomes structurally enforced wherever possible.
Design decisions. Address is modelled as its own entity (not a Musician attribute) with Phone as ITS attribute, connected via LivesAt (Musician N–1 Address). This is what actually captures "no address has more than one phone": since Phone belongs to the Address entity, every musician who shares that address automatically shares its one phone value — the constraint is enforced by the schema itself, not by a side-note. Song is modelled as a weak entity owned by Album through the identifying relationship Contains (total participation on Song, since a song cannot exist without its album), with partial key Title — this directly captures "no song appears on more than one album," because a weak entity has exactly one owner by construction. Plays is the stated many-to-many between Musician and Instrument. Performs is many-to-many between Song and Musician with total participation on Song (every song needs at least one performer). Produces is Album (N) to Musician (1) with total participation on Album (every album needs exactly one producer); a musician may produce zero or many albums, so no total-participation arrow points back at Musician.
Constraints the ER diagram cannot capture. A basic (Chen) ER diagram has no way to express a general, arbitrary-valued constraint that compares attribute values across relationship sets or bounds a many-relationship's multiplicity by an exact number — only the qualitative 1/many distinction is available. Concretely here: we cannot state "a musician may play at most 5 instruments" (only "many"), and we cannot enforce a cross-relationship business rule such as "the producer of an album must also be a performer on at least one of its songs" without additional constraint language (e.g. OCL) or an application-level check; the diagram can express each relationship's own cardinality but not a logical implication between two different relationships.