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 run_by, gb_scanned (the summed bytes), and estimated_cost_usd as a 2-decimal string at $5 per TB. Order by total bytes descending, then run_by.
Result columns · in this order
run_bygb_scannedestimated_cost_usdHow to approach it
Sum gb_scanned per run_by, then convert the total to a 2-decimal dollar string.
Sample input
| run_by | gb_scanned |
|---|---|
| ana | 12 |
| ben | 240 |
| ana | 3 |
| cara | 85 |
| ben | 6 |
| cara | 180 |
6 rows — all rows shown.
Expected output
| run_by | gb_scanned | estimated_cost_usd |
|---|---|---|
| cara | 265 | 1.29 |
| ben | 246 | 1.20 |
| ana | 15 | 0.07 |
3 rows — all rows shown.
Constraints
GROUP BY run_by with SUM(gb_scanned). Convert to dollars with SUM(gb_scanned) / 1024.0 * 5 and format with printf('%.2f', ...). Order by the numeric total DESC, then run_by ASC.
Expected skills
Cost attribution, grouped sums, and decimal-safe cost 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.