Reorder steps so cleaning happens before grouping (kite shop)
The query groups regions before cleaning them, so " north" and "North" are counted separately. Fix the step order.
- Level
- beginner
- Time
- ~8 min
- Task
- Build the query
- Access
- Free — no account needed
Loading the practice workspace…
About this exercise
What you'll practise
See that applied steps run in order, and that cleaning must come before aggregating.
Northwind Kites sells kites and accessories through three regional stores. Orders are exported from the till system every week.
Steps
- The starter query groups by
Regionand then trims and capitalises Region, which is too late. - Reorder so Region is trimmed and capitalised (Capitalize Each Word) before grouping.
- Output:
RegionandOrders(row count).
Your result must
- One row per clean region
- " north" and "North" counted together
- Columns: Region, Orders
Input
- Orders (table)
- OrderID: text
- Customer: text
- Region: text
- Product: text
- Qty: number
- UnitPrice: number
- OrderDate: text
- Status: text
Expected output columns
Region (text), Orders (number)
| Region | Orders |
|---|---|
| East | 5 |
| North | 4 |
| South | 3 |