Blog · Guide
SQL JOIN Explained with a Simple Shop Example
INNER JOIN and LEFT JOIN explained with customers and orders — the same mental model as looking up a name in another spreadsheet.
Why JOINs exist
In a shop database you don’t paste the customer’s full name onto every order. You store customer_id on the order, and keep names in customers. When you want both, you JOIN.
INNER JOIN — only matches
SELECT o.order_id, o.order_date, c.first_name FROM orders o JOIN customers c ON o.customer_id = c.customer_id;
Think Excel: a VLOOKUP that only keeps rows with a successful match.
The shop pattern you’ll reuse
orders→customersoncustomer_idorder_items→productsonproduct_id- Chain both for a full receipt line
Try it yourself
The fastest way to lock this in is a short drill on the same Northstar Market tables.