Categories: Aggregate, Semi-Structured Data
ARRAY_MAX
Returns the maximum value of a list.
Syntax
ARRAY_MAX(list_column LIST) → numeric
- list_column: Column that contains a LIST expression. Every element of the list must be a number such as INT, BIGINT, FLOAT4, FLOAT8, or DECIMAL. Cannot be an array literal.
Examples
array_col contains ARRAY[1, 2, 3]SELECT ARRAY_MAX(array_col)
-- 3
SELECT ARRAY_MAX(array_col)
-- NULL
SELECT ARRAY_MAX(array_col)
-- NULL
SELECT ARRAY_MAX(array_col)
-- NULL
Usage Notes
The return type is T given an input ARRAY<T>
. If the parameter is NULL, this function returns NULL. If the list contains NULL, this function returns NULL. If the list is empty, this function returns NULL.