Skip to main content

GREATEST

Introduced or updated: v1.2.738

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)
├───────────────────┼──────────────────────┤
9NULL
└──────────────────────────────────────────┘
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today