MIN

2025-11-19 10:08:12  Updated

Syntax

MIN([DISTINCT | ALL] expr)

Purpose

MIN() returns the minimum value in the specified data set.

The argument of MIN() can be a string, in which case the minimum string value is returned. The DISTINCT keyword specifies to evaluate only distinct values. By default, ALL is used.

Examples

Assume that the table a has the following three data rows: id=1,num=10, id=2,num=20, and id=3,num=30, you can execute the following statement to obtain the minimum num:

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

Contact Us