Skip to main content
Version: V1.0.0

MIN

Declaration

MIN([DISTINCT | ALL] expr)

Description

Returns the minimum value in the specified data.

The value of MIN() can be a string parameter, returning the smallest string value. The DISTINCT keyword specifies to calculate only distinct values, with the default being ALL.

Examples

Assume table a has three rows of data: id=1,num=10, id=2,num=20, and id=3,num=30. To select the minimum value of num:

SELECT MIN(num) FROM a;
+----------------+
| MIN(num) |
+----------------+
| 10 |
+----------------+
1 row in set (0.001 sec)