SQL Max() Function
Submitted by admin on Thursday, May 5, 2011 - 09:44.
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
- Add new comment
- 156 views