AccessionSQL, one case at a time
#015Level 4 of 6 · Scenario 3: The Conservation Budget

Where the money went

Scenario 3 · The Conservation Budget

The totals by person told finance who was busy. They now want it the other way round — by wing, and by the kind of work, so they can see which combinations are eating the budget.

Schema · 1 table
treatments
  • idpkINTEGER
  • object_titleVARCHAR
  • wingVARCHAR
  • treatment_typeVARCHAR
  • conservatorVARCHAR
  • started_onDATE
  • hoursDOUBLE
  • costDOUBLE

Toolkit

SELECT
Choose which columns come back.
FROM
Specify which table to read.
WHERE
Filter rows by a condition.
ORDER BY
Sort the results by a column.
DESC
Reverse the sort: largest or latest first.
SUM
Add up a numeric column.
GROUP BY
Split into groups. Name more than one column for finer groups.
Objective

Return the wing, the treatment type and the total cost for each combination, most expensive first.

Your query

starting DuckDB…
loading editor…

Results

No result yet.