DuckDB’s list_aggregate()
function is a handy tool for performing grouped aggregations over lists. It allows us to apply any aggregate function (like sum
, avg
, min
, max
, count
, etc.) to a list column as if each list item were a row.
The way it works is that we pass the list as the first argument, followed by the name of an aggregate function we want to apply to that list. The function will return its result as if it were the named aggregate function.
Continue reading