Warehouse average unit cost
For each warehouse, return `city` and `avg_unit_cents`: the total stock value divided by the total quantity, rounded to a whole number. A warehouse holding zero units returns NULL rather than failing. Order by city.
What a strong answer looks like
Say what the query is meant to return before you write it, and name the shape of the answer: how many rows, grouped by what. Then watch the NULLs and the duplicates, because that is where most of these are lost.
Run onlyA query runs as one statement, so there is nothing to step through. Run it and read the rows.
0:00 of about 13 min
query.sql
Expected, in this order
| city | avg_unit_cents |
|---|---|
| Memphis | 966 |
| Osaka | 19900 |
| Rotterdam | 8362 |
Your result
Run your query to compare.
1 more set of rows are waiting. Free with an account.
Run or narrate your approach, then ask the coach.