Skip to content

INNER JOIN

Handout

Joining two tables

To use data from both tables at once, you join them. An INNER JOIN pairs up rows that match on a key — here, the order's customer_id with the customer's id:

SELECT customer.name, orders.total
FROM customer
INNER JOIN orders ON customer.id = orders.customer_id;

When a column name could come from either table, write table.column so it is clear.

Handout

Log in or create account

IGCSE & A-Level