Level 3 project: order overview and slow movers

To wrap up level 3 you build two reports that no single table can answer: an overview of the large orders with customer, handler and total, and a list of products nobody has ordered in months. Both pull together three or four tables and summarize rows.

What you need: JOIN, LEFT JOIN, joining multiple tables, GROUP BY and HAVING, plus COALESCE from the NULL lesson. The second task can also be solved with a subquery and NOT EXISTS.

The setup

In the office supplies shop, a single order is spread over four tables: the header in orders, the buyer in customers, the employee handling it in employees, and the individual items with quantity and price in order_items. What a product is and what it costs lives in products.

Management wants to know which orders are big and who is looking after them. The warehouse wants to know which products are just taking up shelf space. Both questions sound simple. The catch is that some rows have no partner: open orders with nobody assigned, products that were never ordered. Pick the wrong kind of JOIN and those rows quietly vanish, with no error to warn you.

The project

Part 1: overview of the large orders

You're after every order with a total of 400 or more, leaving cancelled ones out. Before you type, jot down which column comes from which table and which link is allowed to be missing.

Task Management wants an overview of the large orders. Find every order that is not cancelled and whose total (quantity times unit_price across all its items) is at least 400. Columns: order_id, order_date, customer (the customer's name), handled_by (the employee's last name; if nobody is assigned, show 'unassigned'), items (number of order lines) and total. Largest total first. Columns in this order and with exactly these names.

orders 18 rows, 5 columns
order_idcustomer_idorder_datestatusemployee_id
100112026-01-08delivered3
100242026-01-12delivered4
100332026-01-20delivered3
100472026-02-03delivered4
100522026-02-11cancelled8
100612026-02-25delivered3
1007102026-03-04delivered2
100852026-03-17delivered4
100982026-03-30delivered3
101062026-04-07delivered8
1011122026-04-22delivered4
101232026-05-06delivered3
101392026-05-19cancelled8
101472026-06-02shipped4
101512026-06-10shipped3
1016112026-06-12openNULL
101742026-06-13openNULL
1018102026-06-14openNULL
customers 12 rows, 7 columns
customer_idnamecitycountrycustomer_sincesegmentphone
1Harbor Fremont PartnersBostonUSA2021-03-15Business617-555-0142
2Emily CarterChicagoUSA2022-07-01ConsumerNULL
3Riverside County OfficeRiversideUSA2020-11-20Government951-555-0110
4Raj PatelLeedsUK2023-01-09Consumer0113 496 0123
5Lakeview Hotel LtdManchesterUK2022-04-18Business0161 496 0456
6Olivia BrooksAustinUSA2024-02-27ConsumerNULL
7Greene & Shaw LLPLondonUK2021-09-05Business020 7946 0321
8Maple Grove High SchoolAustinUSA2023-08-14School512-555-0187
9Chloe EvansBostonUSA2025-05-30Consumer617-555-0199
10Northline Printing CoTorontoCanada2020-06-12Business416-555-0133
11Daniel KimSeattleUSA2024-10-03ConsumerNULL
12Westbrook Dental ClinicChicagoUSA2022-12-01Business312-555-0164
employees 10 rows, 7 columns
employee_idfirst_namelast_namedepartmentsalaryhire_datemanager_id
1KarenMitchellManagement936002018-01-02NULL
2TomBradleySales624002019-04-011
3JuliaReyesSales468002021-06-152
4MarcusAllenSales492002020-09-012
5SarahLongWarehouse396002022-02-011
6FelixTurnerWarehouse354002024-03-185
7NinaCooperAccounting528002019-10-011
8DavidRossCustomer service384002023-05-022
9LauraHughesCustomer serviceNULL2025-09-012
10PaulWardAccounting432002022-11-147
order_items 38 rows, 4 columns
order_idproduct_idquantityunit_price
10011404.79
10013252.79
10016424.9
1002223.49
10021035.49
10031604.69
100311684.9
10033502.59
100443179
100493269
100551449
10061304.79
10067106.99
100782219
100711489.9
10071204.99
100846175
1008253.49
1009101204.99
10092403.19
100992279
1010726.99
1010213.49
1011121129
10111104.99
10113122.79
10126823.9
10121404.69
101391279
101452439
101442179
10151504.79
101511289.9
10161045.49
1017233.49
1017726.99
10181804.79
101861024.9

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

Part 2: slow movers in the warehouse

Now it's about products that haven't been ordered since 1 April. For this task the shop has added a new cork pin board that nobody has ordered yet. It belongs on the list.

Task The warehouse is looking for slow movers: products that have not appeared in any order since 1 April 2026. Cancelled orders don't count, and products that were never ordered belong on the list too. Columns: product (the name), category, stock_value (stock times price) and last_ordered (date of the most recent order that was not cancelled, empty if there is none). Highest stock value first. Columns in this order and with exactly these names.

products 13 rows, 5 columns
product_idnamecategorypricestock
1Copy paper, 500 sheetsPaper4.99420
2Blue ballpoint pens, 10-packWriting3.49310
3Lever arch file, grayFiling2.79185
4Comfort office chairFurniture18912
5Standing deskFurniture4495
6Black ink cartridgePrinter supplies24.964
7Yellow sticky notes, 12 padsWriting6.990
8Mono laser printer L30Electronics2198
927-inch monitorElectronics27915
10Notebook A5, ruledPaper5.49140
11Black toner XLPrinter supplies89.922
12Cross-cut shredderElectronics1290
15Cork pin board, largeFurniture39.914
order_items 38 rows, 4 columns
order_idproduct_idquantityunit_price
10011404.79
10013252.79
10016424.9
1002223.49
10021035.49
10031604.69
100311684.9
10033502.59
100443179
100493269
100551449
10061304.79
10067106.99
100782219
100711489.9
10071204.99
100846175
1008253.49
1009101204.99
10092403.19
100992279
1010726.99
1010213.49
1011121129
10111104.99
10113122.79
10126823.9
10121404.69
101391279
101452439
101442179
10151504.79
101511289.9
10161045.49
1017233.49
1017726.99
10181804.79
101861024.9
orders 18 rows, 5 columns
order_idcustomer_idorder_datestatusemployee_id
100112026-01-08delivered3
100242026-01-12delivered4
100332026-01-20delivered3
100472026-02-03delivered4
100522026-02-11cancelled8
100612026-02-25delivered3
1007102026-03-04delivered2
100852026-03-17delivered4
100982026-03-30delivered3
101062026-04-07delivered8
1011122026-04-22delivered4
101232026-05-06delivered3
101392026-05-19cancelled8
101472026-06-02shipped4
101512026-06-10shipped3
1016112026-06-12openNULL
101742026-06-13openNULL
1018102026-06-14openNULL

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

What matters

Rows first, groups second

Build the query in steps and run it after each one. Start with just the JOINs and no GROUP BY, so you see one row per order line with customer and employee. Once those rows look right, add GROUP BY, then HAVING, then ORDER BY. That way you spot the exact step where rows go missing.

LEFT JOIN when the partner may be missing

A plain JOIN keeps only rows that have a partner on both sides. Open orders have no employee yet; their employee_id is NULL. With JOIN employees they disappear. LEFT JOIN keeps them, the employee columns come back as NULL, and COALESCE swaps in a readable label.

Conditions in ON or in WHERE

With a LEFT JOIN, where you put a condition changes the result. In ON it decides which rows get attached, and the left row stays no matter what. In WHERE it filters the whole result afterwards, and rows without a partner carry NULL there and fall out. For the slow movers this means status <> 'cancelled' belongs in the ON condition for orders.

WHERE for rows, HAVING for groups

The status belongs to each individual order, so it goes in WHERE. The total only exists once rows are grouped, so it goes in HAVING. Put SUM in WHERE and the exercise tells you "Functions like COUNT or SUM do not work in WHERE".

If you get stuck

  • Seven rows instead of eight in part 1 means the open order from Northline Printing is missing. You have JOIN instead of LEFT JOIN in front of employees.
  • Nine rows means the status condition is missing and cancelled order 1005 sneaks in.
  • Two rows instead of three in part 2 means the pin board is missing. Check that HAVING includes MAX(o.order_date) IS NULL and that the status condition sits in ON, not in WHERE. If the monitor is missing, you are counting cancelled orders.
  • If the check says "The values are right, but the columns have other names", an AS is missing. The message lists the names it wants.
  • If the rows are right but in the wrong order, check ORDER BY. The biggest total and the highest stock value go at the top.
  • Both parts are also checked against different data, so typing order or product IDs into the query will fail.

What you have learned in level 3

You can join tables on their keys with JOIN, keep rows without a partner using LEFT JOIN, chain three or more tables, join a table to itself, stack results with UNION, and ask questions with subqueries and EXISTS. That covers almost every report an office needs that spans more than one list. Next up are tools that keep long queries readable and calculate across rows: rankings, running totals and comparisons with the previous month.

FAQ

How many points is the project worth?

Each of the two project tasks counts three times as much as a single exercise, because you have to solve several steps at once.

Is the project free?

No. Projects from level 2 onward are part of Premium. The first exercise in every level 3 lesson is free, so you can still prepare without Premium.

Is there only one correct answer?

No. The check looks at your result, not the wording of your query. Part 2 is just as correct with LEFT JOIN and HAVING as with NOT EXISTS and a subquery. Part 1 must use LEFT JOIN, GROUP BY and HAVING, because that is exactly what the task is about.

Do I need to round the total?

No. The check compares numbers to six decimal places. ROUND(SUM(…), 2) is allowed but not required.

What if I get stuck?

The hints under each task help in three steps: first the idea, then the structure, then an almost finished query. If you are still stuck, go back to the lesson for the piece that trips you up. The links are at the top of this page.

Level 3 complete

Next up is level 4, changing data and building tables. It starts with INSERT: you add new products, customers and order lines to the tables.

Learn INSERT

Write to us

Choose language

Select your preferred language