Comparison Functions

Comparison Functions

Comparison functions determine the greatest or least value from a set of values.

GREATEST(expression1, expression2, ...)

Largest non-NULL, non-MISSING value if the values are of the same type; otherwise NULL.

LEAST(expression1, expression2, ...)

Returns smallest non-NULL, non-MISSING value if the values are of the same type, otherwise returns NULL.