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 partition_day, row_count, and skew_flag ('hot' when row_count is above the average, else 'normal'). Order by row_count DESC, then partition_day.
Result columns · in this order
partition_dayrow_countskew_flagHow to approach it
Label each partition hot or normal by comparing its row_count to the table average.
Sample input
| partition_day | row_count |
|---|---|
| 2026-01-01 | 900 |
| 2026-01-02 | 1100 |
| 2026-01-03 | 800 |
| 2026-01-04 | 4200 |
| 2026-01-05 | 1000 |
| 2026-01-06 | 3000 |
| 2026-01-07 | 1200 |
| 2026-01-08 | 800 |
8 rows — all rows shown.
Expected output
| partition_day | row_count | skew_flag |
|---|---|---|
| 2026-01-04 | 4200 | hot |
| 2026-01-06 | 3000 | hot |
| 2026-01-07 | 1200 | normal |
| 2026-01-02 | 1100 | normal |
| 2026-01-05 | 1000 | normal |
| 2026-01-01 | 900 | normal |
| 2026-01-03 | 800 | normal |
| 2026-01-08 | 800 | normal |
8 rows — all rows shown.
Constraints
Compare row_count to (SELECT AVG(row_count) FROM table_partitions) inside a CASE to label hot vs normal. Order by row_count DESC, partition_day ASC.
Expected skills
Skew detection with a scalar AVG and CASE labels.
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.