> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Aggregate functions

> Compute one result from a set of rows, such as a sum, count, average or approximate distinct count. Most can also run as window functions.

Compute one result from a set of rows, such as a sum, count, average or approximate distinct count. Most can also run as window functions.

| Function | Type | What it does |
| - | - | - |
| [`any_value`](/query/sql/functions/aggregate/any_value) | Aggregate · Window | Returns an arbitrary value from a group. |
| [`approx_count_distinct`](/query/sql/functions/aggregate/approx_count_distinct) | Aggregate · Window | Estimates the number of distinct non-NULL input values. |
| [`approx_percentile`](/query/sql/functions/aggregate/approx_percentile) | Aggregate · Window | Estimates one or more percentiles of non-NULL numeric values. |
| [`approx_quantiles`](/query/sql/functions/aggregate/approx_quantiles) | Being confirmed | Previous docs; being confirmed. |
| [`approx_top_k`](/query/sql/functions/aggregate/approx_top_k) | Aggregate · Window | Returns the approximate most frequent input values. |
| [`arbitrary`](/query/sql/functions/aggregate/arbitrary) | Aggregate · Window | Returns an arbitrary value from a group. |
| [`array_agg`](/query/sql/functions/aggregate/array_agg) | Aggregate · Window | Collects values into an array; non-DISTINCT calls skip NULLs, while grouped DISTINCT calls can retain one NULL. |
| [`array_unique_agg`](/query/sql/functions/aggregate/array_unique_agg) | Aggregate · Window | Collects distinct non-NULL values into an array. |
| [`avg`](/query/sql/functions/aggregate/avg) | Aggregate · Window | Returns the arithmetic mean of non-NULL numeric values. |
| [`bit_or`](/query/sql/functions/aggregate/bit_or) | Aggregate · Window | Returns the bitwise OR of non-NULL integer values. |
| [`bit_xor`](/query/sql/functions/aggregate/bit_xor) | Aggregate · Window | Returns the bitwise XOR of non-NULL integer values. |
| [`bitoragg`](/query/sql/functions/aggregate/bitoragg) | Aggregate · Window | Returns the bitwise OR of non-NULL integer values. |
| [`bool_or`](/query/sql/functions/aggregate/bool_or) | Aggregate · Window | Returns true if any non-NULL input is true. |
| [`collect_list`](/query/sql/functions/aggregate/collect_list) | Aggregate · Window | Collects values into an array; non-DISTINCT calls skip NULLs, while grouped DISTINCT calls can retain one NULL. |
| [`collect_set`](/query/sql/functions/aggregate/collect_set) | Aggregate · Window | Collects distinct values into an array, including at most one NULL. |
| [`corr`](/query/sql/functions/aggregate/corr) | Aggregate · Window | Returns the Pearson correlation coefficient. |
| [`count`](/query/sql/functions/aggregate/count) | Aggregate · Window | Counts rows or non-NULL expression values. |
| [`count_if`](/query/sql/functions/aggregate/count_if) | Aggregate · Window | Counts rows whose condition is true. |
| [`countif`](/query/sql/functions/aggregate/countif) | Aggregate · Window | Counts rows whose condition is true. |
| [`covar_pop`](/query/sql/functions/aggregate/covar_pop) | Aggregate · Window | Returns the population covariance. |
| [`covar_samp`](/query/sql/functions/aggregate/covar_samp) | Aggregate · Window | Returns the sample covariance. |
| [`distinct`](/query/sql/functions/aggregate/distinct) | Being confirmed | Previous docs; being confirmed. |
| [`every`](/query/sql/functions/aggregate/every) | Aggregate · Window | Returns TRUE when every non-NULL Boolean input is TRUE; returns FALSE if any contributing input is FALSE. |
| [`first`](/query/sql/functions/aggregate/first) | Aggregate · Window | Returns the first group/frame value. |
| [`first_value`](/query/sql/functions/aggregate/first_value) | Aggregate · Window | Returns the first group/frame value. |
| [`grouping`](/query/sql/functions/aggregate/grouping) | Aggregate | Returns a number whose bits identify which GROUP BY expressions were omitted from the current grouping set. |
| [`grouping_id`](/query/sql/functions/aggregate/grouping_id) | Aggregate | Returns a number whose bits identify which GROUP BY expressions were omitted from the current grouping set. |
| [`last`](/query/sql/functions/aggregate/last) | Aggregate · Window | Returns the last group/frame value. |
| [`last_value`](/query/sql/functions/aggregate/last_value) | Aggregate · Window | Returns the last group/frame value. |
| [`listagg`](/query/sql/functions/aggregate/listagg) | Aggregate · Window | Concatenates non-NULL strings with a delimiter. |
| [`max`](/query/sql/functions/aggregate/max) | Aggregate · Window | Returns the maximum non-NULL value. |
| [`max_by`](/query/sql/functions/aggregate/max_by) | Aggregate · Window | Returns the value associated with the greatest non-NULL ordering key. |
| [`mean`](/query/sql/functions/aggregate/mean) | Aggregate · Window | Returns the arithmetic mean of non-NULL numeric values. |
| [`median`](/query/sql/functions/aggregate/median) | Aggregate · Window | Returns the interpolated 50th percentile. |
| [`min`](/query/sql/functions/aggregate/min) | Aggregate · Window | Returns the minimum non-NULL value. |
| [`mode`](/query/sql/functions/aggregate/mode) | Aggregate · Window | Returns the most frequent non-NULL value. |
| [`object_agg`](/query/sql/functions/aggregate/object_agg) | Aggregate · Window | Combines key/VARIANT pairs into an object. |
| [`percentile`](/query/sql/functions/aggregate/percentile) | Aggregate · Window | Returns exact interpolated quantiles of non-NULL numeric values. |
| [`percentile_approx`](/query/sql/functions/aggregate/percentile_approx) | Aggregate · Window | Estimates a percentile or an ordered array of percentiles, with accuracy controlled by the accuracy argument. |
| [`percentile_cont`](/query/sql/functions/aggregate/percentile_cont) | Aggregate · Window | Returns exact interpolated quantiles of non-NULL numeric values. |
| [`some`](/query/sql/functions/aggregate/some) | Aggregate | Returns TRUE when any non-NULL Boolean input is TRUE; returns FALSE when all contributing inputs are FALSE. |
| [`stddev`](/query/sql/functions/aggregate/stddev) | Aggregate · Window | Returns sample standard deviation. |
| [`stddev_pop`](/query/sql/functions/aggregate/stddev_pop) | Aggregate · Window | Returns population standard deviation. |
| [`stddev_samp`](/query/sql/functions/aggregate/stddev_samp) | Aggregate · Window | Returns sample standard deviation. |
| [`string_agg`](/query/sql/functions/aggregate/string_agg) | Aggregate · Window | Concatenates non-NULL strings with a delimiter. |
| [`sum`](/query/sql/functions/aggregate/sum) | Aggregate · Window | Returns the sum of non-NULL numeric values. |
| [`var_samp`](/query/sql/functions/aggregate/var_samp) | Aggregate · Window | Returns sample variance. |
| [`variance`](/query/sql/functions/aggregate/variance) | Aggregate · Window | Returns sample variance. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.