MySQL Wildcards

MySQL Wildcards

MySQL Aliases

MySQL Aliases

MySQL Data Types

MySQL Data Types

MySQL Interview Questions

MySQL Interview Questions and Answers


MySQL max() Function

The MySQL max() function returns the maximum or largest value from specific field. It is used when you need to find largest value from fields value.

MySQL MAX FUNCTION Syntax

To find maximum or largest value from specific field in a table, use the following syntax:

Syntax

SELECT MAX(col1) 
FROM tablename
WHERE condition;

Parameters:

tablename: The table name from which you want to fetch records.

col1: The column or field name from which the maximum or largest value will be return.

condition: To specifies the conditions that must be fulfilled. It is optional.

MySQL MAX FUNCTION example

The following MySQL, find maximum or largest value of the numeric field "workingHours" in the "tblCustomerLoan" table:

Example

SELECT MAX(workingHours) AS MinHover FROM tblCustomerLoan;

Note:

In the above example, we are finding maximum or largest value from "workingHours" numeric field in tblCustomerLoan" table.

You can use MySQL Command Line Client to find maximum or largest value from the fields in the specified table. It will look like this: