D8LooPFocus modeCODE 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.
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 |
Expected output
| run_by | gb_scanned | estimated_cost_usd |
|---|---|---|
| cara | 265 | 1.29 |
| ben | 246 | 1.20 |
| ana | 15 | 0.07 |
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.
Run the SQL query to inspect preview rows.