CODE WORKSPACE

Scan cost by analyst

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

query_runsBytes scanned per run, attributed to an analyst.
run_bygb_scanned
ana12
ben240
ana3
cara85
ben6
cara180

Expected output

Expected outputScan volume and estimated cost per analyst at $5/TB, highest first.
run_bygb_scannedestimated_cost_usd
cara2651.29
ben2461.20
ana150.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.

SQL
Loading...

AI evaluation

Run the SQL query to inspect preview rows.