ARRAY_MIN
functionsupportedCore SQL functionsGiven an input ARRAY, returns the element with the lowest value that is not a SQL NULL. If the input ARRAY is empty or contains only SQL NULL elements, this function returns NULL.
Syntax
ARRAY_MIN( <array> )
Parameters
| Name | Required | Description |
|---|---|---|
array | required | The input ARRAY. |
Returns
This function returns a VARIANT that contains the element with the lowest value that is not a SQL NULL. The function returns NULL if array is NULL, empty, or contains only SQL NULL elements.
Usage notes
- A SQL NULL is distinct from an explicit null value in semi-structured data (for example, a JSON null in JSON data). Explicit null values are considered when identifying the element with the lowest value.
- The function determines the element to return by comparing the elements in the array. The function supports comparing elements of the same data type or of the following data types: Elements of the NUMBER and FLOAT data types.
- Elements of the TIMESTAMP_LTZ and TIMESTAMP_TZ data types.
- If the array contains elements of other data types, cast the elements to a common data type, as shown in the example below.