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

Who did what

Scenario 3 · The Conservation Budget

Four conservators share the bench. Before anyone argues about next year's staffing, the head of department wants the same totals you just produced, but one line per person.

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.
COUNT(*)
How many rows there are.
SUM
Add up a numeric column.
GROUP BY
Split the rows into groups first, then run the aggregates once per group.
Objective

Return the conservator, how many treatments they did and their total hours, busiest first by hours.

Your query

starting DuckDB…
loading editor…

Results

No result yet.