← All posts
·4 min read
#database#tutorial#beginners

What Is an ER Diagram and How to Read One

What an ER diagram actually shows — entities, attributes, relationships, and cardinality — and how to read one in under 5 minutes.

The short version

An entity-relationship (ER) diagram is a picture of your database structure. Each entity (table) is a box, each attribute (column) is a row inside it, and each relationship (foreign key) is a line between boxes. Cardinality markers tell you whether one row relates to one or many. If you can read those three elements, you can read any ER diagram.

What an ER diagram shows

SymbolMeaningIn PostgreSQL
Box / entityA tableCREATE TABLE users
Rows inside boxColumns + typesid uuid PRIMARY KEY
PK badgePrimary keyUnique row identifier
FK badgeForeign keyReference to another table
Line with crow's footOne-to-many relationshipREFERENCES users(id)

The three relationship types

One-to-many (1:N) — the most common. One user has many orders. The "many" side holds the foreign key: orders.user_id → users.id. Drawn as a line with a crow's foot (three prongs) on the many end.

Many-to-many (M:N) — via a join table. Users and groups need user_groups(user_id, group_id). Django's auth_user_groups is a classic example. The join table has two foreign keys.

One-to-one (1:1) — rare, usually a vertical split. users and profiles where each user has exactly one profile. Enforced by a UNIQUE on the foreign key.

How to read an ER diagram in 60 seconds

  1. Find the core entity. Usually users — most lines point to it.
  2. Follow the FK lines. Each line is a FOREIGN KEY you could write as a JOIN.
  3. Check cardinality. Crow's foot = many. No crow's foot = one.
  4. Look for join tables. Two FKs, often just two columns + PK = M:N.
  5. Read PKs first. The PK tells you what makes a row unique.

Example: In the Supabase auth diagram, auth.users is the core. Lines radiate to identities and sessions — one user, many identities and many sessions. Each line is a foreign key you can follow with a query.

Why ER diagrams matter for PostgreSQL

PostgreSQL doesn't show you relationships — \d shows one table at a time, information_schema is a wall of text. An ER diagram collapses that into one picture where you can see at a glance: which tables exist, how they connect, where the join tables are, and what you'd need to JOIN to answer a question.

Live-introspected diagrams (like dbdiagramr) guarantee the picture matches production — no drift, no hand-updating. Paste a connection string, get the truth.

FAQ

What is an ER diagram?
A visual map of a database: boxes are tables, rows are columns, lines are foreign key relationships with cardinality (one-to-many, etc.).

What does the crow's foot mean?
It marks the "many" end of a relationship. A line from users to orders with a crow's foot at orders means one user can have many orders.

What's the difference between ER diagram and schema diagram?
They're the same thing in practice. "Schema diagram" emphasizes the PostgreSQL schema; "ER diagram" emphasizes the entity-relationship model. Both show tables, columns, and foreign keys.

How do I make an ER diagram from a PostgreSQL database?
Use pgAdmin's ERD tool for a quick snapshot, or paste your connection string into a live-introspection tool to generate an interactive diagram in 10 seconds.

Visualize your own database

Paste your PostgreSQL connection string and get an interactive ER diagram in under 10 seconds. No signup required.