Average quantity per region when some quantities are missing (bike rental)
Some orders have no quantity yet. Report orders, how many have a quantity, and the average of the known quantities.
- Level
- intermediate
- Time
- ~8 min
- Task
- Build the query
- Access
- Pro
Checking your access…
About this exercise
What you'll practise
Understand how aggregations treat null: counting rows versus counting values versus averaging.
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 (nullable)
- UnitPrice: number
- OrderDate: text
- Status: text
Expected output columns
Region (text), Orders (number), With Qty (number), Avg Qty (number)