GREATEST/LEAST(x,y,...)

GREATEST(x,y,...) or LEAST(x,y) is a special function that calculates the maximum or minimum value of all arguments (expressions).

The functions can be applied to any data type. The data types of the individual expressions must be comparable.

Result of the function

At least one argument is the NULL value

NULL Value

At least one argument is the special NULL value

Special NULL value

Examples

SQL Tutorial, Information About Character Strings