SQLMIN() Function
The SQL MIN() Function
TheMIN() function returns the smallest value of the selected column.
TheMIN() function works with numeric, string, and date data types.
MIN Example
Return the lowest price in the Price column, in the "Products" table:
FROM Products;
Syntax
SELECT MIN(column_name)
FROMtable_name
WHEREcondition;
Demo Database
Below is a selection from theProducts table used in the examples:
| ProductID | ProductName | SupplierID | CategoryID | Unit | Price |
|---|---|---|---|---|---|
| 1 | Chais | 1 | 1 | 10 boxes x 20 bags | 18.00 |
| 2 | Chang | 1 | 1 | 24 - 12 oz bottles | 19.00 |
| 3 | Aniseed Syrup | 1 | 2 | 12 - 550 ml bottles | 10.00 |
| 4 | Chef Anton's Cajun Seasoning | 2 | 2 | 48 - 6 oz jars | 22.00 |
| 5 | Chef Anton's Gumbo Mix | 2 | 2 | 36 boxes | 21.35 |
Set Column Name (Alias)
When usingMIN(), the returned column will not have a name.
Use theAS keyword to give the column a descriptive name:
Use MIN() with Date Column
The following SQL returns the earliest BirthDate in the BirthDate column, in theEmployees table:
Use MIN() with GROUP BY
Here we use theMIN() function and theGROUP BY clause, to return the smallest price for each category in the Products table:
Example
FROM Products
GROUP BY CategoryID;
You will learn more about theGROUP BY clause later in this tutorial.

