least()是MySQL的一个Math函数。此函数用于从列表中获取最小的数字。
语法
select least(exp1, exp2, exp3.....);
参数:
Exp1, exp2, exp3.... expn : 求最小数的表达式。
返回
此函数返回列表中的最小数字。
示例 1
Select least(4,3,2,7);
输出:
mysql> Select least(4,3,2,7);
+----------------+
| least(4,3,2,7) |
+----------------+
| 2 |
+----------------+
1 row in set (0.00 sec)
+----------------+
| least(4,3,2,7) |
+----------------+
| 2 |
+----------------+
1 row in set (0.00 sec)
示例 2
Select least('yxjc123','string_finction','math_function','date_function');
输出:
mysql> Select least('yxjc123','string_finction','math_function','date_function');
+--------------------------------------------------------------------+
| least('yxjc123','string_finction','math_function','date_function') |
+--------------------------------------------------------------------+
| date_function |
+--------------------------------------------------------------------+
1 row in set (0.00 sec)
+--------------------------------------------------------------------+
| least('yxjc123','string_finction','math_function','date_function') |
+--------------------------------------------------------------------+
| date_function |
+--------------------------------------------------------------------+
1 row in set (0.00 sec)
示例 3
Select least('j','A','v','a');
输出:
mysql> Select least('j','A','v','a');
+------------------------+
| least('j','A','v','a') |
+------------------------+
| A |
+------------------------+
1 row in set (0.00 sec)
+------------------------+
| least('j','A','v','a') |
+------------------------+
| A |
+------------------------+
1 row in set (0.00 sec)