Syntax
MAX([DISTINCT | ALL] expr)
Purpose
Returns the maximum value in the specified data.
The value of MAX() can be a string parameter. In this case, it returns the maximum string value. The DISTINCT keyword specifies to calculate only distinct values, with ALL as the default.
Examples
Assume that table a has three rows of data: id=1,num=10, id=2,num=20, and id=3,num=30. Select the maximum value of num.
obclient> SELECT MAX(num) FROM a;
+-----------------+
| MAX(num) |
+-----------------+
| 30 |
+-----------------+
1 row in set
