MAX
Declaration
MAX([DISTINCT | ALL] expr)
Description
Returns the maximum value from the specified data.
The value of MAX() can be a string parameter, in which case it returns the maximum string value. The DISTINCT keyword specifies to calculate only distinct values, with the default being ALL.
Examples
Assume 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.
SELECT MAX(num) FROM a;
+-----------------+
| MAX(num) |
+-----------------+
| 30 |
+-----------------+
1 row in set (0.001 sec)