MySQL Select max min



age
1
3
5
7
9

Maximum

SELECT MAX() The FROM syntax is used to count the maximum data for a field from a data table.

grammar:

SELECT MAX(column) FROM tb_name

The SQL syntax is used to count the maximum value of a numeric type field, MAX() can not be multiple fields.

example:

SELECT MAX(age) FROM user 
Result
9

Minimum

SELECT MIN() The FROM syntax is used to count the minimum data for a field from a data table.

grammar:

SELECT MIN(column) FROM tb_name

The SQL syntax is used to count the minimum value of a numeric type field, MIN() can not be multiple fields.

example:

SELECT MIN(age) FROM user 
Result
1



Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook