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.
- What does the crow's foot (
<) mark? - What question must every relationship line answer?
Show the answers
- The "many" end of a relationship.
- One-or-many, at both ends.
Done here? The practice set for Part 9 — 4 exercises with solutions — is on the part page.