All functions > WINDOW FUNCTION
All functions in the WINDOW FUNCTION category.
Backend availability
DD Available DD Partially available DD Not available DD DuckDB · PG Postgres · CH ClickHouse · TR Trino · BQ BigQuery · SF Snowflake · DB Databricks · SV Serving
Numeric
| Function | Description | Backends |
|---|
SUM() OVER ... | Returns the sum of values in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
AVG() OVER ... | Returns the average of values in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
MIN() OVER ... | Returns the minimum value in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
MAX() OVER ... | Returns the maximum value in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
PRODUCT() OVER ... | Returns the product of values in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
BIT_AND() OVER ... | Returns the bitwise AND of integer values in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
BIT_OR() OVER ... | Returns the bitwise OR of integer values in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
BIT_XOR() OVER ... | Returns the bitwise XOR of integer values in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
Counting
| Function | Description | Backends |
|---|
COUNT() OVER ... | Returns the count of rows in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
COUNT_IF() OVER ... | Returns the count of rows where the condition is true in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
APPROX_DISTINCT() OVER ... | Returns the approximate number of distinct values in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
Boolean
| Function | Description | Backends |
|---|
BOOL_AND() OVER ... | Returns TRUE if all boolean values in the window frame are true. | DD | PG | CH | TR | BQ | SF | DB | SV |
BOOL_OR() OVER ... | Returns TRUE if any boolean value in the window frame is true. | DD | PG | CH | TR | BQ | SF | DB | SV |
Numbering
| Function | Description | Backends |
|---|
ROW_NUMBER() OVER ... | Returns a unique sequential number for each row within its partition, starting at 1. | DD | PG | CH | TR | BQ | SF | DB | SV |
RANK() OVER ... | Returns the rank of the current row within its partition, with gaps. Rows with equal values for the... | DD | PG | CH | TR | BQ | SF | DB | SV |
DENSE_RANK() OVER ... | Returns the rank of the current row within its partition, without gaps. Similar to RANK but... | DD | PG | CH | TR | BQ | SF | DB | SV |
NTILE() OVER ... | Returns the bucket number (1 to n) for each row in a partition, where n is the number of buckets. | DD | PG | CH | TR | BQ | SF | DB | SV |
PERCENT_RANK() OVER ... | Returns the relative rank of the current row: (rank - 1) / (total rows - 1). | DD | PG | CH | TR | BQ | SF | DB | SV |
CUME_DIST() OVER ... | Returns the cumulative distribution: (number of rows <= current row) / (total rows). | DD | PG | CH | TR | BQ | SF | DB | SV |
Offset
| Function | Description | Backends |
|---|
LEAD() OVER ... | Returns the value from the row that leads (follows) the current row by a specified offset within... | DD | PG | CH | TR | BQ | SF | DB | SV |
LAG() OVER ... | Returns the value from the row that lags (precedes) the current row by a specified offset within... | DD | PG | CH | TR | BQ | SF | DB | SV |
FIRST_VALUE() OVER ... | Returns the first value in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
LAST_VALUE() OVER ... | Returns the last value in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
NTH_VALUE() OVER ... | Returns the value at the nth row of the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
Collection
| Function | Description | Backends |
|---|
ANY_VALUE() OVER ... | Returns a non-null value of the window frame: the minimum in value order, NULL if there is none. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_AGG() OVER ... | Returns an array of all values in the window frame. | DD | PG | CH | TR | BQ | SF | DB | SV |
MIN_BY() OVER ... | Returns the value of the first expression corresponding to the minimum value of the second... | DD | PG | CH | TR | BQ | SF | DB | SV |
MAX_BY() OVER ... | Returns the value of the first expression corresponding to the maximum value of the second... | DD | PG | CH | TR | BQ | SF | DB | SV |
STRING_AGG() OVER ... | Concatenates string values in the window frame in order up to the current row, separated by the... | DD | PG | CH | TR | BQ | SF | DB | SV |
Statistical
Summary
Functions in this category: 43