Limiting Large Results
We would like to find the average weight of cats grouped by breed. Also, in the same query find the average weight of cats grouped by breed whose age is over 1
Return: breed, average_weight, average_old_weight Order by: breed Show Table Schema
Correct output but can you use 'filter'?
Filter can be used to adjust our aggregate functions
select breed, avg(weight) as average_weight, avg(weight) filter (where age > 1) average_old_weight from cats group by breed order by breed