The
MIN function is used to find out the minimum value in a specified column among a given set of records.
SQL MIN SYNTAX
Select MIN (column_name) from tablename;
Consider the
Products table which has the following records:
Prd001 |
Pen |
40.25 |
Prd002 |
Pen |
100.75 |
Prd003 |
Eraser |
10.35 |
Prd004 |
Pencil |
20.45 |
Prd005 |
Book |
50.65 |
Prd006 |
Gum |
25.22 |
To fetch the least value of a product, the min function can be used on the
ProductPrice column as shown below:
Select MIN(ProductPrice) as MinProductPrice FROM Products;