The Busiest Months
The last slide is about the busiest months: the months in which customers placed at least 3 paid orders. The refunded orders don't count. Show each such month in the form 2024-12 as month, the number of its paid orders as paid_orders, and how many different customers placed them as customers, sorted by month:
| month | paid_orders | customers |
|---|---|---|
| 2024-12 | 3 | 3 |
| 2025-11 | 3 | 3 |
In both months, three different customers placed the three orders, but the two numbers aren't always the same: a customer can place several orders in one month.
A tip: some conditions are about a single order, and others about a whole month. Remember from the lesson on grouping where each of them goes.
That's the whole project. You've summed up the shop in three queries: they group rows by calculated values, count and average them, and keep only the groups that matter. Each of them, though, has used a single table. In the next lesson, you'll learn to join tables, so that one query can show, for example, the names of the customers next to their orders.
Instructions
Below the comment -- 3. The busiest months, write the query for the last slide.
Start programming for free
3/3