Skip to main content

Categories: Aggregate, Semi-Structured Data

ARRAY_MIN

Returns the minimum value of a list.

Syntax​

ARRAY_MIN(list_column LIST) → numeric​

  • list_column: A numeric array to find the minimum element of. Every element of the list must be a number such as INT, BIGINT, FLOAT4, FLOAT8, or DECIMAL.

Examples

array_col contains ARRAY[1, 2, 3]
SELECT ARRAY_MIN(array_col)
-- 1
array_col contains ARRAY[1,2,null]
SELECT ARRAY_MIN(array_col)
-- NULL
array_col contains ARRAY[null]
SELECT ARRAY_MIN(array_col)
-- NULL
array_col contains null
SELECT ARRAY_MIN(array_col)
-- NULL
ARRAY_MIN with an array of decimal values
SELECT ARRAY_MIN(ARRAY[1.5, 2.5, 3.5])
-- 1.5

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.