You can connect a third table too
A query can pull in as many tables as it needs, one at a time. Each new table gets its own JOIN and its own ON, connecting it to a table already in the query. Read it top to bottom as a chain: this connects to that, and that connects to the next.
A tiny example
In plain English: Show me each student with their class, and the room that class meets in.
SELECT s.name, c.title, r.name AS room
FROM students s
JOIN classes c ON c.id = s.class_id
JOIN rooms r ON r.id = c.room_id;What comes back
| name | title | room |
|---|---|---|
| Amara | Biology | R1 |
| Theo | History | R2 |
Each row walked the whole chain — student to class to room — so all three appear together.
Related SQL lessons
Ready for a break?
Take on today's cozy puzzle. A fresh, bite-sized query waits every morning — no timers, no pressure.
play today's sip