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

The lines finance will ask about

Scenario 3 · The Conservation Budget

Anything over five thousand pounds gets a line of its own in the committee papers. That is five thousand across a whole category of work — not five thousand for one job, which never happens.

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 the rows into groups.
HAVING
Filter the groups after they are built. WHERE filters rows before.
Objective

Return each treatment type whose total cost is over 5000, with that total, most expensive first.

Your query

starting DuckDB…
loading editor…

Results

No result yet.