Skip to main content

LEAST

Introduced or updated: v1.2.738

Returns the minimum value from a set of values. If any value in the set is NULL, the function returns NULL.

See also: LEAST_IGNORE_NULLS

Syntax

LEAST(<value1>, <value2> ...)

Examples

SELECT LEAST(5, 9, 4), LEAST(5, 9, null);
┌────────────────────────────────────┐
│ least(5, 9, 4) │ least(5, 9, NULL) │
├────────────────┼───────────────────┤
│ 4 │ NULL │
└────────────────────────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today