Relationships and cardinalities
Linking entities: binary, reflexive, ternary and attribute-carrying relationships, minimum and maximum cardinalities in Merise notation, reading both ways and the match with UML multiplicities.
- 25 cards
- 5 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- Scenarios
- Understand
A few cards from the deck
Relationship: what is it?
Show the answer
A link named by a verb that joins occurrences of entities, most often of two entities: a customer places orders, an order contains products.
The relationship links occurrences, not whole entities: Ms Durand places order 12, not every order. Each end is called a leg.
Rule: "a customer may place several orders, or none yet; an order is placed by exactly one customer". What are the cardinalities of PLACE?
- CUSTOMER 0,n and ORDER 1,1
- CUSTOMER 1,1 and ORDER 0,n
- CUSTOMER 0,n and ORDER 0,n
- CUSTOMER 1,n and ORDER 1,1
Show the answer
CUSTOMER 0,n and ORDER 1,1
Each cardinality is read from its own entity: an order takes part in exactly one link (1,1), a customer in zero or more (0,n). CUSTOMER 1,1 and ORDER 0,n swaps them; CUSTOMER 1,n would require at least one order per customer; ORDER 0,n would allow an order with no customer, or with several.
A minimum of 0 makes participation …; a minimum of 1 makes it ….
Show the answer
A minimum of 0 makes participation optional; a minimum of 1 makes it mandatory.
"A book has at least one author" gives 1 on the BOOK side; "an author may not have written anything yet" gives 0 on the AUTHOR side.
Cardinality: what is it?
Show the answer
A pair of numbers (minimum, maximum), written on a leg, that says how many links an occurrence of the entity can take part in.
The minimum is 0 or 1 (optional or mandatory participation), the maximum 1 or n (a single link or several). It is read from the entity that carries it.
Rule: "a student enrols in several modules and gets a mark for each". Where should the attribute mark go?
- On STUDENT, since the student is the one marked
- On MODULE, since the mark relates to a module
- As the identifier of the relationship ENROL
- On the relationship ENROL
Show the answer
On the relationship ENROL
The mark depends on the pair (student, module): on STUDENT it would be single for all their modules, on MODULE single for all its students. It cannot be an identifier either: two students can get the same mark.