A newer version of this documentation is available.

View Latest

Comparison Functions

  • reference
    +

    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.