least()

Returns the smallest value. For strings lexicographical ordering is used. Note that uppercase characters are considered “smaller” than lowercase characters, and collations are not supported.

Arguments & returns

least(arg1, …)

Scalar
Overload link arg1 … Varargs Returns
#01 ANY ANY ANY

… accepts a variable number of arguments of the type shown.

Example

1 more ↓
least example
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Engine example · Run to view results.

More examples

least example 2
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Engine example · Run to view results.

In other engines

Snowflakeleast_ignore_nulls()

SELECT LEAST_IGNORE_NULLS(1, 2)
In DuckDB
SELECT LEAST(1, 2)

SQLGlot example ↗

Used in larger rewrites 1

These examples use least as one part of a larger SQL translation.

BigQueryleast()

SELECT LEAST(1, NULL, 3)
In DuckDB
SELECT CASE WHEN 1 IS NULL OR NULL IS NULL OR 3 IS NULL THEN NULL ELSE LEAST(1, NULL, 3) END

SQLGlot example ↗