Skip to main content

SQL Max() Function

Body

The MAX function is use to return the largest value of the selected column. MAX can be use only in numeric column.

As with other function, you can also give an Alias to the MAX function.

SQL MIN() Syntax

SELECT Max(column_name) FROM Table

Consider the following table for this exercise

Users

Firstname Lastname Salary DeptID
John Smith 1000 1
Mathew Simon 3000 1
Bill Steve 2200 1
Amanda Rogers 1800 2
Steve Hills 2800 2
Steve jobs 2400 2
bill cosby 700 3

Example # 1

SELECT Max(Salary) AS MaximumSalary FROM users

Result of the Query

MaximumSalary
3000

The query return the largest salary from the dataset

Comments

Add new comment