SQL
List Aggregates
The function [`list_aggregate`](#::list_aggregatelist-name) allows the execution of arbitrary existing aggregate functions on the elements of a list. Its first argument is the list (column), its second argument is the aggregate function name, e.g., `min`, `histogram` or `sum`.  
`list_aggregate` accepts additional arguments after the aggregate function name. These extra arguments are passed directly to the aggregate function, which serves as the second argument of `list_aggregate`.  
```sql
SELECT list_aggregate([1, 2, -4, NULL], 'min');
```  
```text
-4
```  
```sql
SELECT list_aggregate([2, 4, 8, 42], 'sum');
```  
```text
56
```  
```sql
SELECT list_aggregate([[1, 2], [NULL], [2, 10, 3]], 'last');
```  
```text
[2, 10, 3]
```  
```sql
SELECT list_aggregate([2, 4, 8, 42], 'string_agg', '|');
```  
```text
2|4|8|42
```  
#### `list_*` Rewrite Functions {#docs:sql:functions:list::list_-rewrite-functions}  
The following is a list of existing rewrites. Rewrites simplify the use of the list aggregate function by only taking the list (column) as their argument. `list_avg`, `list_var_samp`, `list_var_pop`, `list_stddev_pop`, `list_stddev_samp`, `list_sem`, `list_approx_count_distinct`, `list_bit_xor`, `list_bit_or`, `list_bit_and`, `list_bool_and`, `list_bool_or`, `list_count`, `list_entropy`, `list_last`, `list_first`, `list_kurtosis`, `list_kurtosis_pop`, `list_min`, `list_max`, `list_product`, `list_skewness`, `list_sum`, `list_string_agg`, `list_mode`, `list_median`, `list_mad` and `list_histogram`.  
```sql
SELECT list_min([1, 2, -4, NULL]);
```  
```text
-4
```  
```sql
SELECT list_sum([2, 4, 8, 42]);
```  
```text
56
```  
```sql
SELECT list_last([[1, 2], [NULL], [2, 10, 3]]);
```  
```text
[2, 10, 3]
```