GREATEST

DB2 (9.5 onward), MySQL, Oracle, and PostgreSQL implement the GREATEST function to return the largest value from a list of values:

GREATEST(value [, value ...])

The input values may be numbers, datetimes, or strings. On some platforms, if even one input value is null, then the function returns null.

Get SQL Pocket Guide, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.