Intermediate Joins · INNER JOIN
11. Orders with customer names
Concept: INNER JOINshow
JOIN combines rows from two tables wherever the ON condition matches, usually a foreign key such as orders.customer_id = customers.id. Give tables short aliases (o, c) and prefix columns with them.
Example (different data):
SELECT i.id, p.title FROM order_items i JOIN products p ON p.id = i.product_id;
Your task
Finance flags every order of $200 or more for manual review. Reviewers need the customer's name, not an id.
Return order_id, name (the customer's name) and amount for every order with an amount of at least 200, largest first.
Solution unlocks after 3 more tries
Starting Postgres in your browser…
query.sql
Output
Write a query and press Run Query (Ctrl/⌘ + Enter).