Why this matters
Customers rarely announce that they have left; they just stop ordering. At Lakeside Office Supply (made up) nobody noticed a dental practice had gone quiet until the year-end review, months too late for a call to help.
The owner now wants a list every Monday: every customer with no order since 1 September, with the account manager next to each name. In this module you build that list with two tables and a LEFT JOIN, and see why a plain JOIN would have hidden the one customer who never ordered at all.
What you’ll build
A customers table (five customers, two account managers), the orders table, and a call-list query.
With the sample data: Elm Street Law (never ordered) and Harbor Accounting (last order 19 August) for Ana, and Maple Dental (27 August) for Sam.
What you need
- Nothing to start the practiceThe practice is built from real DB Fiddle screens and runs in this page.
- A browser, to do it for realDB Fiddle is free and needs no account.
Concepts
3 ideas you’ll use in the practice.
Two tables, one link
Real systems keep customers and orders in separate tables. A JOIN puts them side by side: FROM customers c JOIN orders o ON o.customer = c.name matches every order to its customer. The short names c and o (aliases) save typing.
JOIN drops, LEFT JOIN keeps
A plain JOIN keeps only rows that match on both sides, so a customer with no orders disappears. A LEFT JOIN keeps every row from the left table (customers) and fills the order columns with null where there is no match.
Any "who has not ..." question (not ordered, not paid, not replied) needs a LEFT JOIN.
MAX and HAVING for "last activity"
MAX(o.order_date) gives each customer's latest order date. HAVING MAX(o.order_date) < '2026-09-01' OR MAX(o.order_date) IS NULL keeps customers whose latest order is older than the cut-off, or who never ordered.
Practice
Do every step yourself in a practice copy of the real tool. It checks your work, and “Do it for me” finishes any step you get stuck on.
Do it for real
Now repeat it in your own account. Tick each step as you go.
Quick check
3 questions to check you’ve got it.
1. Why was Elm Street Law missing from the first JOIN result?
- It is spelled wrong
- It has no orders, and a plain JOIN keeps only matching rows
- Its manager is Ana
Show the answer
It has no orders, and a plain JOIN keeps only matching rows. A JOIN keeps only customers with at least one order. A LEFT JOIN keeps every customer.
2. What does MAX(o.order_date) give you per customer?
- Their biggest order
- Their latest order date
- Their number of orders
Show the answer
Their latest order date. MAX on a date column is the most recent date.
3. With the sample data, which customers are on the call list?
- Cobalt Legal and Northside Realty
- Elm Street Law, Harbor Accounting and Maple Dental
- Only Elm Street Law
Show the answer
Elm Street Law, Harbor Accounting and Maple Dental. Cobalt Legal (22 September) and Northside Realty (9 September) ordered after 1 September; the other three did not.
You reached the end of SQL for Business Reports Jump Start
That completes the SQL jump start: a monthly report, your top customers and a call list, all straight from the data.
Pick your next course →