MAX Function

SQL uses the MAX function to find the maximum value in a column. The syntax for using the MAX function is,

SELECT MAX("column_name")
FROM "table_name"

For example, if we want to get the highest sales from the following table,

Table Store_Information

store_nameSalesDate
Los Angeles$1500Jan-05-1999
San Diego$250Jan-07-1999
Los Angeles$300Jan-08-1999
Boston$700Jan-08-1999

we would type in

SELECT MAX(Sales) FROM Store_Information

Result:

MAX(Sales)
$1500

$1500 represents the maximum value of all Sales entries: $1500, $250, $300, and $700.

Next: SQL MIN