A JOIN connects two tables
Data is often split across tables: students in one, classes in another. Each student row stores a class_id, and each class row has an id. JOIN lets one query use both tables, and ON says which two columns to compare — here class_id and id. Where the values are the same, the student and the class are shown together on one row.
A tiny example
In plain English: Show me each student's name next to the title of the class they belong to.
SELECT s.name, c.title
FROM students s
JOIN classes c ON c.id = s.class_id;What comes back
| name | title |
|---|---|
| Amara | Biology |
| Theo | History |
| Jin | Art |
Each student found their class by matching class_id to the class's id, so the two sit side by side.
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