liveBook · Manning

Minimum cardinality

As explained in Grokking Relational Database Design

Minimum cardinality is the smallest number of related entity instances required or permitted for an entity instance in a relationship.

Minimum cardinality states the fewest related records an entity instance must have in one direction of a relationship. It is usually zero or one: zero means a related record is optional, while one means it is required. Read it directionally: for a relationship from A to B, it counts the minimum number of B records associated with one A record. section 5.5

In Crow’s Foot notation, cardinality uses two symbols placed near the entity being counted. The inner symbol shows the minimum; the outer symbol shows the maximum. Start with a plain requirement sentence, such as “A user has zero, one, or more accounts,” then identify zero as the minimum and many as the maximum from user to account. section 5.5

Making a one-to-one relationship workable

A department has one manager, and a manager works for one department, appears to require a minimum of one in both directions. That design creates an insertion problem: neither record can be entered first while both foreign keys require an existing related record. Relax one minimum to zero—for example, let a department have zero or one manager—so records can be inserted. The zero minimum also helps identify the foreign-key placement for a one-to-one relationship. section 5.6

Practical rules of thumb:

  • Describe each direction separately; the minimum from user to account is not automatically the minimum from account to user. section 5.5
  • Check whether a minimum of one makes first-time data entry impossible because related records must already exist. section 5.6
  • After establishing maximum cardinalities, document minimum cardinalities and foreign-key locations for every entity pair. section 8.8

Use the diagram to compare a theoretically required one-to-one relationship with the relaxed minimum that permits insertion. section 5.6

How Grokking Relational Database Design covers it

How deep it goes
Defines directional minimum symbols and works through relaxing a one-to-one minimum to resolve insertion constraints.
Examples
Uses user-account, department-manager, and spaceship manufacturer entity relationships to identify minima and foreign-key locations.
What it assumes
Introduces minimum cardinality through plain relationship sentences before using Crow’s Foot symbols and foreign keys.
What you can do after
Apply it to mark optional participation, relax impractical one-to-one requirements, and document foreign-key placement.
How it connects
Connects cardinality with Crow’s Foot notation, E-R diagrams, one-to-one relationships, foreign keys, and junction tables.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Relational Database Design. The section links point to the parts of the book it draws on.