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 partitions_scanned, mb_scanned, partitions_total, and mb_total for a partition_day range of 2026-01-03 to 2026-01-05.
Result columns · in this order
partitions_scannedmb_scannedpartitions_totalmb_totalHow to approach it
Aggregate the in-range partitions, then add scalar subqueries for the full-table totals.
Sample input
| partition_day | row_count | size_mb |
|---|---|---|
| 2026-01-01 | 900 | 36 |
| 2026-01-02 | 1100 | 44 |
| 2026-01-03 | 800 | 32 |
| 2026-01-04 | 4200 | 168 |
| 2026-01-05 | 1000 | 40 |
| 2026-01-06 | 3000 | 120 |
| 2026-01-07 | 1200 | 48 |
| 2026-01-08 | 800 | 32 |
8 rows — all rows shown.
Expected output
| partitions_scanned | mb_scanned | partitions_total | mb_total |
|---|---|---|---|
| 3 | 240 | 8 | 520 |
1 row — all rows shown.
Constraints
Filter table_partitions on partition_day BETWEEN '2026-01-03' AND '2026-01-05'. Use COUNT(*) and SUM(size_mb) for the scanned figures, and scalar subqueries over the full table for the totals.
Expected skills
Partition pruning reasoning and quantifying scanned vs total data.
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.