MIN returns the minimum or lowest value from a set of values.
This function ignores NULL values.
This example returns the minimum, or lowest, product price.
SELECT MIN(UnitPrice) AS 'Min'
FROM Product
| Min |
|---|
| 2.50 |
Syntax of the MIN function.
MIN(value)
value -- a value, column, or subquery.
| ORDER |
|---|
| Id |
| OrderDate |
| OrderNumber |
| CustomerId |
| TotalAmount |
SELECT MONTH(OrderDate) AS Month
MIN(TotalAmount) AS 'Total Sales'
FROM [Order]
WHERE YEAR(OrderDate) = 2013
GROUP BY MONTH(OrderDate)
| Month | Min Order Amount |
|---|---|
| 1 | 49.80 |
| 2 | 174.90 |
| 3 | 147.00 |
| 4 | 136.80 |
| 5 | 110.00 |
![]() |
|
| PRODUCT |
|---|
| Id |
| ProductName |
| SupplierId |
| UnitPrice |
| Package |
| IsDiscontinued |
| SUPPLIER |
|---|
| Id |
| CompanyName |
| ContactName |
| City |
| Country |
| Phone |
| Fax |
SELECT S.CompanyName,
MIN(UnitPrice) AS 'Lowest Price'
FROM Product P
JOIN Supplier S ON S.Id = P.SupplierId
GROUP BY S.CompanyName
| CompanyName | Lowest Price |
|---|---|
| Aux joyeux ecclésiastiques | 18.00 |
| Bigfoot Breweries | 14.00 |
| Cooperativa de Quesos 'Las Cabras' | 21.00 |
| Escargots Nouveaux | 13.25 |
| Exotic Liquids | 10.00 |
![]() |
|