GREATEST



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

See also: GREATEST_IGNORE_NULLS

Syntax

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

Examples

SELECT GREATEST(5, 9, 4), GREATEST(5, 9, null);
┌──────────────────────────────────────────┐ │ greatest(5, 9, 4) │ greatest(5, 9, NULL) │ ├───────────────────┼──────────────────────┤ │ 9 │ NULL │ └──────────────────────────────────────────┘

Was this page helpful?