Skip to content
Contents/CH 05
Modeling/Intermediate · 16 min

ERD Relationships & Constraints

Relationships are where ERDs get interesting. Cardinality and participation decide whether a schema is faithful or subtly wrong.

In plain English

A relationship is a sentence like "a student takes a course." Cardinality says how many students and courses can fit in that sentence.

The one idea

Cardinality and participation decide where the foreign key goes and whether it is allowed to be null.

Wrong cardinality produces duplicate rows, impossible relationships, or a junction table that should not exist. The diagram is where that error is cheapest to fix.

By the end

  1. 01Read relationship diamonds and cardinality labels.
  2. 02Distinguish 1:1, 1:N, and M:N relationships.
  3. 03Explain total and partial participation.
  4. 04Model weak entities and identifying relationships.
01

Relationships and degree

A relationship connects entities. Its degree is the number of entity sets involved: unary (recursive), binary, or ternary. Student and Course have a binary relationship called "enrolls." A recursive relationship connects an entity to another entity of the same set. For example, an employee can manage other employees.

chapter-05.db
[Student] --enrolls-- [Course]      binary
[Employee] --manages--> [Employee]   unary
[Supplier] --supplies-- [Part] --to-- [Project]  ternary
02

Cardinality and participation

Cardinality describes how many entities can participate: one-to-one, one-to-many, or many-to-many. Participation describes whether every entity must participate: total participation (double line) or partial participation (single line). A course may have many students, but every offering must have at least one instructor — those are separate constraints.

03

Weak entities and identifying relationships

A weak entity has no independent key. It is connected to an owner by an identifying relationship. For example, a Dependent is identified by the combination of Employee ID and Dependent Name. The identifying relationship is drawn with a double diamond, and the weak entity with a double rectangle.

Worked example3 steps

Department, professor, and course

A university has departments, professors, and courses. A department has many professors. A professor can teach many courses, and a course can have many professors.

01

Place department_id as a foreign key in Professor.

The 1:N relationship is stored on the many side.

02

Create Teaching(professor_id, course_id) for the M:N relationship.

Neither professor nor course needs a repeating group.

03

Give each professor at most one office.

A unique foreign key or a separate 1:1 table enforces the rule.

ConclusionThe foreign key always lives on the many side of a 1:N relationship. M:N requires a junction relation. 1:1 needs a uniqueness rule.

Instrument

Watch it happen.

Step through one operation at a time

Step player01 / 03
01

Identify the entities

The domain has two strong entities: Student and Course. Each has an independent key.

StudentCourse

The trade-off

No free correctness.

Gain

Relationships that cannot be represented incorrectly by accident.

Cost

Optional relationships require nullable foreign keys, which weakens some constraints.

Verdict

Model participation explicitly: ask whether every entity must participate, not just whether it may.

Recap

What to keep.

Takeaways

  • +Relationship degree counts the entity sets involved.
  • +Cardinality is 1:1, 1:N, or M:N.
  • +Participation says whether every entity must take part.
  • +Weak entities use an owner's key plus a partial key.
  • +M:N relationships become separate tables in the relational model.

Traps

  • !Confusing cardinality with participation.
  • !Forgetting that a recursive relationship still has a role for each side.
  • !Modeling a weak entity as a strong one with an unrelated key.

Focus

  • →Label both sides of a relationship with cardinality.
  • →Explain total versus partial participation.
  • →Convert an M:N relationship into two 1:N relationships plus a junction table.

Check yourself

Before you turn the page.

0 / 2 answered
01

What does M:N mean?

02

What does total participation mean?

DB//COSMOS

A field manual for database systems: model the domain, normalize the facts, query the relations, and protect the result.

Edition 2026 · 32 chaptersTopic catalogInterview prep