LEAST_FUNC

All functions > COMPARISON > LEAST_FUNC

Returns the least (minimum) value from a list of arguments.

Syntax

LEAST_FUNC(exprs)
sql

Arguments

ParameterTypeRequiredDescription
exprsARRAYBIGINTYesVariable 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

Examples

Numeric values

Other types

Last update at: 2025/10/13 10:23:46