Syntax
MAX([DISTINCT ALL] expr)
Purpose
You can call this function to return the maximum value in the specified data set.
The argument of MAX() can be a string, in which case the maximum string value is returned. The DISTINCT keyword specifies to evaluate only distinct values. By default, ALL is used.
Examples
Assume that Table a has the following three data rows: id=1,num=10, id=2,num=20, and id=3,num=30, you can execute the following statement to obtain the maximum num:
obclient> SELECT MAX(num) FROM a;
+-----------------+
MAX(num)
+-----------------+
30
+-----------------+
1 row in set (0.00 sec)