Pivot order statuses into columns (bakery)
Count orders per region with one column per status (Complete, Cancelled, Pending).
- Level
- advanced
- Time
- ~10 min
- Task
- Build the query
- Access
- Pro
Checking your access…
About this exercise
What you'll practise
Pivot a column with an aggregation, preparing the input so only the right columns take part.
The scenario, sample data, step list, hints and solution open with Pro. Grading checks your query against hidden data as well as the visible sample, so a query that only fits the sample doesn't pass.
Input
- Orders (table)
- OrderID: text
- Customer: text
- Region: text
- Product: text
- Qty: number
- UnitPrice: number
- OrderDate: text
- Status: text
Expected output columns
Region (text), Pending (number), Cancelled (number), Complete (number)