Sign in to run and submit your work
Reading is open to everyone. Running code and saving drafts need an account so your work is yours and comes back on your next visit.
or
CODE WORKSPACE
Return query_id, query_label, and gb_per_partition (gb_scanned divided by partitions_scanned, as a 2-decimal string). Order by the numeric ratio descending, then query_id.
Result columns · in this order
query_idquery_labelgb_per_partitionHow to approach it
Divide gb_scanned by partitions_scanned in decimal math, then format the ratio.
Sample input
| query_id | query_label | gb_scanned | partitions_scanned |
|---|---|---|---|
| 1 | daily_active_users | 12 | 8 |
| 2 | orders_export | 240 | 8 |
| 3 | revenue_by_country | 3 | 2 |
| 4 | event_funnel | 85 | 6 |
| 5 | late_event_audit | 6 | 1 |
| 6 | adhoc_select_star | 180 | 8 |
6 rows — all rows shown.
Expected output
| query_id | query_label | gb_per_partition |
|---|---|---|
| 2 | orders_export | 30.00 |
| 6 | adhoc_select_star | 22.50 |
| 4 | event_funnel | 14.17 |
| 5 | late_event_audit | 6.00 |
| 1 | daily_active_users | 1.50 |
| 3 | revenue_by_country | 1.50 |
6 rows — all rows shown.
Constraints
Force decimal math with gb_scanned * 1.0 / partitions_scanned, then format with printf('%.2f', ...). Order by the numeric ratio DESC, query_id ASC.
Expected skills
Per-partition scan efficiency and decimal-safe ratio formatting.
Submit for review to find out what your query gets right, what it gets wrong, and how it compares with the best working query for this exercise.
This scenario runs a full workspace — editor, canvas and results side by side. It needs a laptop or desktop to be usable. Open this page on a bigger screen to start building.