MIN function in MySQL

MySQL MIN
In MySQL, the MIN function is used to get the minimum value of an expression.

Syntax:

SELECT MIN (aggregate_expression)
FROM table_name
WHERE conditions;

Parameters:

Aggregate_expression: It is used to specify the column or expression to be utilized by the MIN function.

Example: Items table:

ID NAME QUANTITY
1 Electronics 30
2 Sports 45
3 Fashion 100
4 Grocery 90
5 Toys 50

 

Query:

SELECT MIN(quantity) AS “Minimum Quantity”
FROM items;

Output:

MINIMUM QUANTITY
30

Explanation:

The ‘items’ is an existing table from which we are calculating the minimum value of ‘quantity’.