LEAST_FUNC
All functions > COMPARISON > LEAST_FUNC
Returns the least (minimum) value from a list of arguments.
Syntax
LEAST_FUNC(exprs)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
exprs | ARRAYBIGINT | Yes | Variable number of expressions to compare (minimum 1) |
Returns
Same type as the input arguments - the minimum value
Notes
- All arguments must be of the same or compatible types
- If any argument is NULL, the result is NULL
- For strings, uses lexicographic (dictionary) ordering
- For dates/timestamps, returns the earliest date/time
- Can accept any number of arguments (not just two)
- Equivalent to finding the minimum value across multiple columns
- Opposite of GREATEST function