The
MAX function is used to find out the maximum value in a specified column from a given set of records.
SQL MAX SYNTAX
Select MAX (column_name) from tablename;
The
Products table has the following records:
Prd001 |
Pen |
40.25 |
Prd002 |
Pen |
100.75 |
Prd003 |
Eraser |
10.35 |
Prd004 |
Pencil |
20.45 |
Prd005 |
Book |
50.65 |
Prd006 |
Gum |
25.22 |
To find the maximum value of a product, the max function is used on the ProductPrice column as shown below:
Select MAX(ProductPrice) as MaxPrice from Products;