BeginnerCoder

Lesson 12 — JOIN

JOIN: combine two tables

Good databases split data into several tables to avoid repeating it: customers in one table, orders in another. Each order stores a foreign key — the id of its customer. JOIN ... ON glues rows together where the keys match. An INNER JOIN (plain JOIN) keeps only rows that have a match on both sides. Short aliases (o, c) save typing.

SELECT p.title, a.name
FROM posts p JOIN authors a ON p.author_id = a.id

Why it matters: almost every real query touches more than one table — JOIN is how you ask "whose order is this?".

Want it another way?
Task

Fill in the ON condition that links orders to customers. Expected: each order with its customer name.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.