Course map
Stage 1: Foundation
Stage 2: Intermediate
Stage 3: Advanced
Stage 4: Performance & internals
Stage 5: Specialization

Part 09 / Topic 2 of 7

ER diagrams

An entity-relationship diagram is the model at a glance: boxes for entities, lines for relationships, crow's feet (the three-pronged end) marking the "many" side. shopdb's core, sketched:

 suppliers ──<  products  >── categories
                   |
                   ^
 customers ──<  orders ──<  order_items
     |             |
     ^             ^
   events       payments

Read a line by its ends: one supplier has many products (──<); each product belongs to one supplier. The exact notation matters less than the discipline: every relationship drawn, every line answering "one or many?" at both ends before any SQL exists. Five minutes of boxes catches the errors that cost days after launch — a diagram is cheap to redraw; a shipped table is not.

Draw them with a pencil, a whiteboard, or tools like dbdiagram.io or Mermaid — the medium is irrelevant; the answered questions are the artifact.

🧪 Quick quiz — answer from memory, then check.

  1. What does the crow's foot (<) mark?
  2. What question must every relationship line answer?
Show the answers
  1. The "many" end of a relationship.
  2. One-or-many, at both ends.

Done here? The practice set for Part 9 — 4 exercises with solutions — is on the part page.

Search the guide