MySQL max() function

The MySQL max() function is used to return the maximum value of an expression. It is used when you need to get the maximum value from your table.


SELECT MAX(aggregate_expression)
FROM tables
[WHERE conditions];

Parameter explanation

aggregate_expression: It specifies the column or expression, from which the maximum value will be returned.

table_name: It specifies the tables, from where you want to retrieve records. There must be at least one table listed in the FROM clause.

WHERE conditions: It is optional. It specifies the conditions that must be fulfilled for the records to be selected.

MySQL max() function example

Consider a table named "employees", having the following data.

mysql max() 1

Execute the following query:

SELECT MAX (working_hours) AS "Maximum working hours"
FROM employees;


mysql max() 2
Related Tutorial
Follow Us #
Contents +