SQL MAX Function

Saturday, December 10, 2011

tags SQL

The SQL MAX function returns the largest value of the selected column.

Employees Table

employeeIDemployeeNameage
1000John Smith40
1001Fred White27
1002Jane Scott53
1003Samuel Williams31


In this example, we want to find the maximum age in the employees table.


Syntax

SELECT MAX(column_name)
FROM Table


Example
SELECT MAX(age) as [Max Age]
FROM employees


Results

Max Age
53


The SQL MAX function is used to find the largest value in a given column.

Did you find the page informational and useful? Share it using one of your favorite social sites.

Recommended Books & Training Resources

SQL Cookbook Head First SQL: Your Brain on SQL A Learners Guide