Memra

Relationships: degree (unary/binary/ternary) & cardinality

◈ 5 cards

Read and write relationships — type vs instance, degree (unary/binary/ternary), and the min/max cardinality notation the exam makes you translate to English.

Relationship type vs instance

A relationship type is a meaningful association among entity types, drawn as a line labeled with a present-tense verb phrase (Registers For, Manages) — defined once as metadata. A relationship instance is a specific association between individual entity instances — "Melton completed C++ in June 2017." Same type/instance split as entities. Two entity types can have multiple, distinct relationships between them (EMPLOYEE Works In DEPARTMENT and EMPLOYEE Manages DEPARTMENT) as long as each captures a different association with its own cardinality.

Degree — how many entity types participate

The degree of a relationship is the number of entity types that participate:

  • Unary (degree 1, recursive) — one entity type related to itself. EMPLOYEE Manages EMPLOYEE; PERSON Is Married To PERSON; ITEM Has Components ITEM (bill-of-materials).
  • Binary (degree 2) — two entity types; the most common. Comes in three cardinality flavors: one-to-one, one-to-many, many-to-many.
  • Ternary (degree 3) — a simultaneous association among three entity types. A ternary is NOT three binaries: an attribute like Unit Cost on a Vendor–Part–Warehouse supply cannot be pinned to any single pair, so decomposing into binaries loses information. The guideline: convert every ternary (and higher) to an associative entity with three mandatory-one binary relationships (Module 2.5).

Cardinality — the numbers on the line

Each relationship carries two cardinality specs — one read from each end — and each spec has a minimum and a maximum.

  • Minimum cardinality is 0 or 1. 0 = optional participation (drawn as a small circle ○). 1 = mandatory participation (drawn as a vertical bar |).
  • Maximum cardinality is one (a vertical bar |) or many (a crow's foot ⋔). A specific fixed max (e.g. at most 5 projects) is written as a number near the crow's foot — but fixed maxima are unstable rules, often enforced in application logic rather than the schema.

The inner symbol (nearest the box) is the maximum; the outer symbol (further along the line) is the minimum. The four combinations and their plain English:

NotationMin / MaxPlain English
bar … barmandatory one (1,1)must be associated with exactly one
bar … crow's footmandatory many (1,N)must be associated with one or more
circle … baroptional one (0,1)may be associated with at most one (or none)
circle … crow's footoptional many (0,N)may be associated with zero or more

Always read both directions. In CUSTOMER—Submits—ORDER: from CUSTOMER, optional many (a customer may have zero or more orders); from ORDER, mandatory one (every order belongs to exactly one customer).

Worked example — reading the Nurse / Care-Centre diagram

The sample exam draws Nurse and Care Centre with three relationships. Focus on the unary one on Nurse, labeled Supervises / Supervised_by. At the top end (Supervises) the notation is a bar (max one) — each nurse is supervised by at most one nurse. At the bottom end (Supervised_by) the notation is a circle + crow's foot — minimum zero, maximum many.

Translate the circle + crow's foot directly: a nurse may supervise none (the circle = optional, minimum 0), exactly one, or many (the crow's foot = maximum many) other nurses. In one sentence: "each nurse can supervise one, none, or many nurses." That is the true statement. Watch the distractors: Works_in relates Nurse to Care Centre with a bar on the Nurse side, so a nurse works in exactly one centre — "more than one care centre" is false. The diagram says nothing about supervision being "discharged," so that option is just noise. The whole skill is mechanical: find each end's circle/bar (minimum) and bar/crow's-foot (maximum), then read it as one of the four canonical phrases.

Supervises / Supervised_byWorks_inNURSECARE_CENTRE
Reading min/max cardinality — the sample exam's Nurse/Care-Centre diagram (Part A Q4).
NORMAL ~/memra/learn/comp-378/relationships-degree-cardinality utf-8 LF