City University of Hong Kong · FACULTY OF INFORMATION TECHNOLOGY

IS5413 Chap.4 Relationship Degree and Cardinality Constraints

- one subject, every graph, every model, every mark
6 Chapters4-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 4 of 11 · IS5413

Relationship Degree and Cardinality Constraints

Degree first, because it fixes how many ends there are

Degree counts how many entity types take part in one relationship, and it is decided before anything else because the answer determines how many ends need cardinality. A unary relationship has one entity type on both ends of the line, so a staff member supervises other staff members. A binary relationship joins two entity types and is the common case.

A ternary relationship involves three at once, drawn as a single diamond with three legs, and each leg is read by holding the other two fixed and asking how many of the third the rule permits.

Two facts at each end, decided separately

Minimum cardinality answers whether participation is compulsory: zero means optional and one or more means mandatory.

Maximum cardinality answers how many are permitted: exactly one, or more than one. The notation puts the minimum mark nearest the box and the maximum mark outside it, which gives four combinations: mandatory one, optional one, mandatory many and optional many.

Students who decide the maximum first and copy the minimum across produce diagrams where both ends carry the same mark, and that symptom is usually visible before the content is checked.

Narratives state the maximum plainly and leave the minimum implicit, so the minimum is the one to write an assumption about when the text is silent.

When a relationship has to become an entity

Some facts belong to the association itself rather than to either participant.

The date a staff member finished a course is not a property of the person and not a property of the course; it exists only because that person took that course.

The published tests for converting are that all the relationships for the candidate should be many, that it could have meaning independent of the other entity types, that it would ideally carry an identifier of its own together with further attributes, and that it may participate in other relationships.

Ternary relationships are told to convert by default, because a three legged diamond is difficult to give a workable identifier to and will need one as soon as the relations are written.

History changes the cardinality, not just the attribute list

A time stamp is a time value attached to a data value, usually recording when the change occurred.

Once history must be kept, an attribute that looked simple becomes something else: a price with an effective date, repeated, is both multivalued and composite at once. The structural answer is an associative entity carrying a date from and a date to, where every past assignment is a row and the current one is the row with no end date. The move that is easy to miss is that the cardinality has changed too.

Without history a title has exactly one product line and the relationship is one to many; with history a title has had many lines and a line has held many titles, so the same pair of boxes is now many to many.

In this chapter

What this chapter covers

  • 01

    Unary, binary and ternary degree

  • 02

    Minimum against maximum cardinality

  • 03

    The four notations and how to read them

  • 04

    Two entity types sharing more than one relationship

  • 05

    The published tests for an associative entity

  • 06

    Time stamped history and the cardinality it changes

Worked example · free

Read a ternary relationship leg by leg

Q [9 marks]. AskSia authored practice. A catering firm records that a supplier delivers an ingredient to a kitchen. The rules are that a supplier may deliver many ingredients to any number of kitchens but need not deliver any; every ingredient must be delivered by at least one supplier to some kitchen; and every kitchen must receive at least one ingredient. Each delivery arrangement records a unit price and a lead time. State the degree, give the minimum cardinality on each leg, and say what structure the arrangement attributes force. The marks shown here are a study allocation and are not the University's published marking scheme.
The four notations.The four notations. Read each end from the inside out: the mark nearest the box is the minimum and the outer mark is the maximum.Mandatory onemin 1, max 1Optional onemin 0, max 1Mandatory manymin 1, max manyOptional manymin 0, max manyNearest mark is the minimum, outer mark is the maximum
The four notations. Read each end from the inside out: the mark nearest the box is the minimum and the outer mark is the maximum.
  • 2State the degree and justify it from the narrative.
  • 4Give the minimum cardinality on each of the three legs.
  • 3Say what the unit price and lead time force, and why.
The degree is ternary, because three entity types participate in one arrangement and no pair of them carries the fact on its own. The supplier leg has minimum zero, since delivering is optional for a supplier. The ingredient leg has minimum one, since every ingredient must be delivered by someone somewhere. The kitchen leg has minimum one, since every kitchen must receive something. The unit price and lead time belong to the three way arrangement rather than to any participant, so they force an associative entity carrying both, with a foreign key to each of the three participants; the published guidance would have converted this ternary relationship anyway.
Sia tip — Read each leg by fixing the other two entity types and asking how many of the third the rule allows, and write the answer down before moving to the next leg.
Glossary

Key terms

Degree
How many entity types take part in one relationship: one, two or three. Decided before cardinality.
Minimum Cardinality
Whether participation in a relationship is compulsory. Zero makes it optional; one or more makes it mandatory. Narratives usually leave this implicit.
Maximum Cardinality
How many instances at the far end one instance may be associated with: exactly one, or more than one. Narratives usually state this plainly.
Unary Relationship
A relationship in which one entity type relates to itself, such as staff supervising staff or a course being a prerequisite for another course.
Time Stamp
A time value attached to a data value, recording when the event that changed the data occurred. Once history is required, structure has to change to hold it.
FAQ

Relationship Degree and Cardinality Constraints FAQ

How do I read cardinality on a ternary relationship?

Fix two of the three entity types and ask how many instances of the third the business rule permits, then repeat for each leg. Reading all three at once produces confusion, because the rules are stated one leg at a time in the narrative as well. Write down each leg's answer before moving on, since the second leg often sounds like a restatement of the first until the fixed pair is named explicitly.

When should a many to many relationship become an associative entity?

When the association carries attributes of its own, when it could have meaning independent of the participants, and preferably when it has or deserves an identifier. The clearest signal is an attribute that belongs to neither participant alone. The published guidance also says ternary relationships should always be converted, regardless of whether they carry attributes, because the identifier problem arrives either way.

Why does keeping history change the relationship, not just the attribute?

Because the old relationship recorded only the current state. Once every past assignment has to survive, one instance on each side can be linked to many instances on the other over time, so a one to many relationship becomes many to many and needs a relation of its own carrying the dates. Students usually spot the new attribute and miss the cardinality change that came with it.

Study strategy

Exam move

Take five narratives and for each one write only the relationship lines: degree, then maximum at each end, then minimum at each end, in that order, with an explicit assumption wherever the narrative is silent about a minimum. Do not draw anything. The point is to make the three decisions consciously and in sequence, because almost every cardinality error comes from deciding the maximum and letting the minimum follow by habit.

Working through Relationship Degree and Cardinality Constraints in IS5413? Sia is AskSia’s AI Information Technology tutor — ask any IS5413 Relationship Degree and Cardinality Constraints question and get a clear, step-by-step explanation grounded in how IS5413 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 16 of your City University of Hong Kong subjects - and 1,000+ Bibles across every Australian university.
Sia - your IS5413 tutor, unlimited, worked the way the exam marks it
The full 4-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works