MAX function in MySQL

How to return the maximum value in MySQL?

Explanation

MAX Function:
MySQL MAX Function returns the maximum value from the given set of values in an expression. MAX() returns the maximum value of the parameter passed and returns NULL if no matching rows are found.
Syntax:
max()


Consider an example of an employee table
Example:
mysql>select max(salary) as salary from employee;
+-------------+
| salary |
+-------------+
| 7000 |
+-------------+
1 rows in set (0.03 sec)


Ask Questions

Ask Question