ID EN
Comparison Functions and Operators

GREATEST(value1,value2,...)

MySQL 8.4

With two or more arguments, returns the largest (maximum-valued) argument. The arguments are compared using the same rules as for LEAST().

Syntax

MYSQL
SELECT GREATEST(2,0);
2
SELECT GREATEST(34.0,3.0,5.0,767.0);
767.0
SELECT GREATEST('B','A','C');
'C'

Examples

Example

GREATEST() returns NULL if any argument is NULL.

MYSQL
SELECT GREATEST(2,0);
2
SELECT GREATEST(34.0,3.0,5.0,767.0);
767.0
SELECT GREATEST('B','A','C');
'C'