ARRAY_MIN
All functions > ARRAY > ARRAY_MIN
Returns the smallest value in an array using natural ordering.
Syntax
ARRAY_MIN(array: ARRAY<T>) → T
sql
Type Parameters:
T
: Any comparable type that supports ordering
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
array | ARRAY<T> | Yes | The array to find the minimum value from |
Returns
The smallest value in the array, or NULL for empty arrays
Notes
- Returns the minimum element using natural ordering
- Ignores NULL values when determining the minimum
- Returns NULL if array is empty or contains only NULL values
- Works with numbers, strings, dates, or any comparable type
- Uses lexicographic ordering for strings