Diagram Conventions   «Prev  Next»

Lesson 5Diagramming types of relationships
ObjectiveIdentify the constructs for diagramming relationship types in Crow's Foot notation.

ER Diagram Relationship Types: One-to-One, One-to-Many, and Many-to-Many

Relationship types describe how many instances of one entity may be associated with instances of another. The familiar 1:1, 1:N, and M:N labels describe maximum cardinality. They do not specify whether participation is optional or required.

Read each endpoint as the number of instances at that end related to one instance at the opposite end. A full Crow's Foot endpoint combines a minimum with a maximum: a circle permits zero, a minimum bar requires one, and the outer bar or crow's foot sets the maximum to one or many.

Maximum-cardinality overview: one-to-one has a bar at each end, one-to-many a bar and crow's foot, and many-to-many a crow's foot at each end.
This overview shows maximum cardinalities only. Minimum participation is omitted: “many” means multiple related instances are permitted, not that one or more must exist. Add minimum markers to express complete rules.

The Crow's Foot Means Many

Abstract illustration of one parent record associated with multiple child records, with a one-to-many maximum-cardinality connector.
The arrows illustrate one-to-many conceptually; they are not foreign-key values or Crow's Foot symbols. The connector below shows maximum cardinality only. In actual rows, several child foreign-key values can repeat the same parent key.

Do not interpret “many” as a minimum. An office with no employees can satisfy a 1:N rule when employee participation for the office is optional. Minimum participation must be stated separately.

1. One-to-One: Limit the Child Reference with UNIQUE

EMPLOYEE has zero or one OFFICE; each OFFICE references exactly one EMPLOYEE. OFFICE.EmpID is a NOT NULL, UNIQUE foreign key.
This example allows employees without an office, while each office must reference exactly one employee. UNIQUE on OFFICE.EmpID prevents multiple office rows from referencing the same employee.

The rule describes an individual office assignment, not a shared workplace. It differs from earlier office examples that allowed many employees per office. Requirements determine the relationship; the entity names alone do not.

A foreign key plus NOT NULL and UNIQUE enforces this optional 1:1 pattern. It does not require every employee to have an office. A shared-primary-key child table likewise limits a parent to at most one child without requiring a child for every parent. Mandatory participation on both sides needs an additional enforcement strategy.

2. One-to-Many: Put the Reference on the Many Side

A SUPPLIER may have zero or many PRODUCT rows; each PRODUCT references exactly one supplier through a NOT NULL foreign key.
PRODUCT.SuppID may repeat across products. Do not make it UNIQUE when one supplier is allowed to supply many products.

This simplified rule chooses one supplier per product. If a product can have multiple suppliers, a supplier-product association would be needed instead. An empty supplier is allowed here; a product with a missing supplier reference is not.

3. Many-to-Many: State the Conceptual Rule

Conceptual STUDENT to CLASS relationship with zero-or-many endpoints on both sides.
A direct M:N connection is valid in a conceptual diagram. Here, a student may have no enrollments and a class may have no students.

CLASS represents one class offering. The same student can join different offerings, but this example permits only one enrollment per student-offering pair.

4. Resolve the Pairings into an Associative Table

STUDENT_CLASS joins STUDENT and CLASS through two one-to-many relationships. StudID and ClassID together form its composite primary key and each is a foreign key.
This retained overview shows the maximum-cardinality structure. CPK/FK marks a component of one composite primary key that is also a foreign key. Minimum markers are omitted; under this lesson's rule, each parent has zero or many junction rows and each junction row has exactly one of each parent.

An associative entity[1] records the relationship itself. STUDENT_CLASS stores one row per pairing, with optional relationship attributes such as Grade. Two foreign keys and a composite primary key implement the association without repeating student or class descriptions.

Translate the Rules into Constraints

The following examples use SQLite with foreign-key enforcement enabled. Run PRAGMA foreign_keys = ON; before a transaction. IDs are supplied explicitly. Other systems may require platform-specific setup or types. These examples emphasize relationship constraints, not a complete operational schema.

PRAGMA foreign_keys = ON;

CREATE TABLE EMPLOYEE (
    EmpID INTEGER PRIMARY KEY,
    EmpLastName VARCHAR(60) NOT NULL,
    EmpFirstName VARCHAR(60) NOT NULL
);
CREATE TABLE OFFICE (
    OfficeNo INTEGER PRIMARY KEY,
    EmpID INTEGER NOT NULL UNIQUE,
    OfficeDept VARCHAR(100),
    FOREIGN KEY (EmpID) REFERENCES EMPLOYEE(EmpID)
);

CREATE TABLE SUPPLIER (
    SuppID INTEGER PRIMARY KEY,
    SuppName VARCHAR(100) NOT NULL
);
CREATE TABLE PRODUCT (
    ProdID INTEGER PRIMARY KEY,
    SuppID INTEGER NOT NULL,
    ProdName VARCHAR(100) NOT NULL,
    FOREIGN KEY (SuppID) REFERENCES SUPPLIER(SuppID)
);

CREATE TABLE STUDENT (
    StudID INTEGER PRIMARY KEY,
    StudentName VARCHAR(100) NOT NULL
);
CREATE TABLE CLASS (
    ClassID INTEGER PRIMARY KEY,
    ClassName VARCHAR(100) NOT NULL
);
CREATE TABLE STUDENT_CLASS (
    StudID INTEGER NOT NULL,
    ClassID INTEGER NOT NULL,
    Grade VARCHAR(2),
    PRIMARY KEY (StudID, ClassID),
    FOREIGN KEY (StudID) REFERENCES STUDENT(StudID),
    FOREIGN KEY (ClassID) REFERENCES CLASS(ClassID)
);

The figures and SQL use the same relationship rules; descriptive attributes are shortened where they are not central to the example. UNIQUE limits office assignments, repeated SuppID values permit many products, and the junction primary key prevents duplicate student-class pairs. NOT NULL requires each child reference, while the foreign key requires a matching parent. None of these requires every parent to have a child.

Elements of a Crow's Foot ER Diagram

The overview below summarizes boxes and maximum-cardinality connectors. It is not a complete participation legend.

Overview of entity boxes, maximum-cardinality connectors for M:N, 1:N and 1:1, and one stylized associative-entity box.
Special corners for the “composite entity” are a drawing convention, not a universal requirement. An associative entity may have a composite key or another justified key strategy. Use the tool's legend and state minimum participation explicitly.

Common Mistakes

See Crow's Foot notation for the endpoint combinations.

ER Diagram Check

For SUPPLIER ||-----o{ PRODUCT, can a supplier have no products? Yes. Can a product have no supplier? No. Can two products reference the same supplier? Yes. The next lesson examines mandatory and optional participation in more detail.

[1] Associative entity: An entity representing a relationship between other entities, typically implemented as a junction table containing their references and any attributes of the association.

SEMrush Software 5 SEMrush Banner 5