Skip to content
flowchart.tools

Data modeling

Crow's foot notation explained: reading cardinality in ER diagrams

By Published 4 min read

The short answer

Each end of a crow's foot relationship line carries two marks. The mark touching the table is the maximum, a bar for one or a three-pronged crow's foot for many. The mark further along the line is the minimum, a circle for zero or a bar for one. Read a relationship by starting at one table and looking at the marks at the other end: "each customer places zero or many orders". In SQL, the many side holds the foreign key, NOT NULL on that key makes the other end exactly one, and UNIQUE on it turns one-to-many into one-to-one.

Crow's foot notation is the most common way to draw relationships in an entity-relationship diagram, and the most commonly misread. The symbols are simple. The confusion comes from two questions: which end of the line do you read, and which of the two marks at that end is which?

This guide answers both, then connects each symbol to the SQL that enforces it. If a diagram says something the schema does not enforce, the diagram is wrong, however tidy it looks.

The four crow's foot line endingsFour relationship lines ending at a table. The mark touching the table is the maximum, a bar for one or a crow's foot for many. The mark further out is the minimum, a circle for zero or a bar for one. Exactly one is two bars; zero or one is a circle and a bar; one or many is a bar and a crow's foot; zero or many is a circle and a crow's foot. On the right, customers and orders are joined by exactly one at the customer end and zero or many at the order end, read in both directions.THE FOUR ENDINGSminimum (further out)maximum (touching the table)tableExactly onemin 1 · max 1tableZero or onemin 0 · max 1tableOne or manymin 1 · max manytableZero or manymin 0 · max manyREADING ONE RELATIONSHIPcustomersordersEach order is placed byexactly one customer.Each customer placeszero or many orders.Start at one table, read the marks at the other end.
The four endings. Nearest the table: the maximum. Further out: the minimum.

Two marks at each end

Every relationship line has two ends, and each end carries two marks:

  • The mark touching the table is the maximum. A single bar means one. The three-pronged crow's foot means many.
  • The mark further along the line is the minimum. A circle means zero (optional). A bar means one (mandatory).

Combine them and there are four endings:

Ending Marks (outer, inner) Minimum Maximum Read as
Exactly one bar, bar 1 1 "one and only one"
Zero or one circle, bar 0 1 "at most one, optional"
One or many bar, crow's foot 1 many "at least one"
Zero or many circle, crow's foot 0 many "any number, including none"

Which end to read

Read a relationship from one table to the marks at the other end. For a line between customers and orders, with exactly one at the customer end and zero or many at the order end:

  • Start at customers, read the order end: each customer places zero or many orders.
  • Start at orders, read the customer end: each order is placed by exactly one customer.

Always read both directions. Most modeling errors show up as a sentence that is false in one of them: "each order is placed by zero or one customers" is a bug if guest checkout is not a feature.

From symbols to SQL

Crow's foot maps almost directly onto a relational schema. The many side holds the foreign key, and the constraints on that key decide the marks.

CREATE TABLE customers (
  id         bigint PRIMARY KEY,
  email      text NOT NULL UNIQUE
);

CREATE TABLE orders (
  id          bigint PRIMARY KEY,
  customer_id bigint NOT NULL REFERENCES customers(id),  -- exactly one customer
  placed_at   timestamptz NOT NULL
);

CREATE TABLE invoices (
  id       bigint PRIMARY KEY,
  order_id bigint NOT NULL UNIQUE REFERENCES orders(id)  -- one order; zero or one invoice per order
);

CREATE TABLE products (
  id   bigint PRIMARY KEY,
  name text NOT NULL
);

CREATE TABLE order_items (
  order_id   bigint NOT NULL REFERENCES orders(id),
  product_id bigint NOT NULL REFERENCES products(id),
  quantity   int NOT NULL CHECK (quantity > 0),
  PRIMARY KEY (order_id, product_id)                     -- junction table: many-to-many
);

How each constraint shows up on the diagram:

SQL Effect on the diagram
Foreign key column on orders orders is the many side; crow's foot at the order end
NOT NULL on the foreign key Minimum of one at the customer end: exactly one
Nullable foreign key Minimum of zero at the parent end: zero or one
UNIQUE on the foreign key Maximum of one at the child end: one-to-one, as with invoices
A junction table with two foreign keys Many-to-many, drawn as two one-to-many lines into the junction
Nothing (no constraint can require it) A minimum of one on the many side, such as every customer has an order

That last row matters. A foreign key can force every order to have a customer, but plain DDL cannot force every customer to have at least one order. If your diagram shows one or many at the order end, something else has to enforce it: application code, a trigger, or a deferred constraint. Otherwise draw zero or many, because that is what the database will actually allow.

Common mistakes

Marks on the wrong end. The most frequent error is drawing the crow's foot at the one side because "a customer has many orders" sounds like it belongs to the customer. The crow's foot always sits next to the table that has many rows per relationship, which is the table holding the foreign key.

Many-to-many drawn directly. A crow's foot at both ends of one line is fine in a conceptual sketch, but no relational database stores it that way. When the diagram is meant to become a schema, draw the junction table, because it is where attributes like quantity or enrolled_at live.

Optional and mandatory swapped. Ask whether a row can exist without the other. Can an order exist without a customer? Can a customer exist without an order? Each "yes" is a circle at the far end.

Mixing notations. Chen notation (diamonds for relationships, ovals for attributes) and crow's foot answer different needs. Chen is good for conceptual modeling and teaching; crow's foot maps to tables. Pick one per diagram.

Mermaid's version of the same symbols

Mermaid's erDiagram writes crow's foot endings as characters, which is a handy way to check your reading. Each side of -- has two characters: the one next to the entity name is the maximum, the one next to the dashes is the minimum.

erDiagram
  CUSTOMER ||--o{ ORDER : places
  ORDER ||--o| INVOICE : "billed by"
  ORDER ||--|{ ORDER_ITEM : contains
  PRODUCT ||--o{ ORDER_ITEM : "appears in"

|| is exactly one, o| (or |o on the left) is zero or one, |{ is one or many and o{ is zero or many. Note ORDER ||--|{ ORDER_ITEM: an order with no items is not an order, a rule the checkout code enforces even though the schema cannot.

Drawing it in flowchart.tools

Paste the SQL above into SQL to ER diagram and every table and foreign key appears as a crow's foot diagram, laid out automatically. The converter draws each foreign key as zero or many at the child end and exactly one at the parent. Where a key is nullable or unique, open the diagram in the editor, select the line, and set its ends in the inspector: the ER line presets include one to one, one to zero-or-one, one to many and many to many.

The ER diagram guide covers table shapes and Chen symbols, and the e-commerce ER diagram template is a complete worked schema. If you are modeling classes rather than tables, the UML relationships guide explains how multiplicity does the same job in a class diagram.

Common questions

Which end of the line do I read in crow's foot notation?
The far end. To describe how many orders a customer has, start at the customer table and read the marks at the order end. Then reverse it: start at orders and read the marks at the customer end to learn how many customers an order has.
How do I model a many-to-many relationship?
With a junction table. Students and courses become students, courses and enrollments, where enrollments holds a foreign key to each and usually a composite primary key. The diagram then shows two one-to-many relationships, each pointing into the junction table.
Can SQL enforce "one or many"?
Not with a foreign key alone. A foreign key can require that every order has a customer, but nothing in plain DDL requires that every customer has at least one order. That rule needs application logic, a trigger, or a deferred constraint, so mark it on the diagram only if something actually enforces it.
What is the difference between crow's foot and Chen notation?
Chen notation draws relationships as diamonds and attributes as ovals, which suits conceptual modeling and teaching. Crow's foot draws tables as boxes with their columns and puts cardinality on the line ends, which maps directly to a relational schema and is the usual choice for database design.

Put this into practice

Open the editor and draw it. Connectors stay attached, the layout tidies itself, and your diagram never leaves your browser.

Open sql to er diagram

Related diagram types and tools

Templates to start from

More guides