SQL Min() Function
Submitted by admin on Wednesday, May 4, 2011 - 20:30.
The MIN function is use to return the smallest value of the selected column. MIN can be use only in numeric column.
As with other function, you can also give an Alias to the MIN function.
SQL MIN() Syntax
SELECT MIN(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 MIN(Salary) AS MinimumSalary FROM Users
Result of the Query
MinimumSalary |
---|
700 |
The query Returns the smallest salary from the dataset.
Add new comment
- 40 views