Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
Aggregate function. Returns the highest value observed in all rows in an aggregation. “Highest” is determined by the collation rules of the data passed in.
This aggregate function is not to be confused with GREATEST, which is a non-aggregate function returning the highest value in its list of arguments.
MAX ( expression )
The highest value, in the type of the input.
SELECT MAX(person_id) FROM people;
+----------------+
| MAX(person_id) |
+----------------+
| 6336 |
+----------------+
SELECT MAX(first_name) FROM people;
+-----------------+
| MAX(first_name) |
+-----------------+
| Zula |
+-----------------+