Gallery: Picture Explainers for JOINs
JOINs are much easier to understand as pictures than as words. This gallery collects the pages on this site that explain JOINs visually. Each entry has a caption describing the picture, so you can pick the one that matches how you like to learn.
Two tables, side by side
Page: A Picture-by-Picture Guide to Keys Linking Two Tables
Caption: two small tables drawn next to each other, with arrows from each order to its customer. Start here if you are not yet sure *why* tables are linked at all.
Matching rows, step by step
Page: INNER JOIN and LEFT JOIN, One Small Step at a Time
Caption: rows are matched one at a time, with the result table growing as you go. Good for seeing exactly where each output row comes from.
The four join types, same data
Page: Compare Options: INNER, LEFT, RIGHT and FULL JOIN
Caption: the same two tiny tables joined four ways, with the unmatched rows highlighted. Ideal if you keep mixing up LEFT and INNER.
Counting the rows
Page: Calculator Notes: How Many Rows Will My JOIN Return?
Caption: small tables with tally marks next to each row. Shows why some joins return more rows than you expect.
Planning on paper
Page: Worksheet: Planning Your First JOIN on Paper
Caption: a set of boxes to fill in before writing SQL. Visual in a different way: it maps your thinking.
Relationships, drawn out
Page: One-to-Many and Many-to-Many, Drawn Out
Caption: "crow's foot" style diagrams of one-to-many and many-to-many relationships, with a linking table in the middle. Helps you see which JOIN a relationship needs.
Why LEFT JOIN loses rows
Page: Session Notes: Why Did My LEFT JOIN Lose Rows?
Caption: a before-and-after picture showing how a WHERE condition can quietly undo a LEFT JOIN. A favourite "aha" moment for many learners.
Suggested viewing order
| If you are... | Start with | Then |
|---|---|---|
| Brand new to JOINs | Keys linking two tables | Matching rows step by step |
| Confused by join types | The four join types | Why LEFT JOIN loses rows |
| Getting odd row counts | Counting the rows | Relationships, drawn out |
Make your own picture
The best diagram is the one you draw yourself. Take two small tables from your own project, draw them on paper, and draw a line between every pair of rows that match. Then write the JOIN query. If the result matches your drawing, you have understood it.
A free learning page for beginners. Practise on a test database, never on real customer data, and check the official documentation for your database version.