Inner, outer, semi, anti and cross joins on orders and customers — and the NULL and duplicate traps that skew totals.
Orders only store customer_id; the name and country live in customers. A join pairs each order with the customer rows whose key satisfies the ON condition. An INNER JOIN (plain JOIN) keeps only pairs that match: orders with a NULL or unknown customer drop out, and so do customers who never ordered.
Give tables short aliases (o, c) and qualify every column — once two tables are joined, a bare customer_id is ambiguous. When the key has the same name on both sides, USING (customer_id) is a shorter ON.
SELECT o.order_id, o.amount, c.name, c.country
FROM orders o
JOIN customers c
ON o.customer_id = c.customer_id;
-- same join, key with the same name on both sides
SELECT order_id, amount, name, country
FROM orders JOIN customers USING (customer_id);Reach the last step for the run summary: the key takeaways from this lesson.