mysql向上,向下,四舍五入取整函数

cecq1mwuyt39a

其中ceil为向上取整,round为四舍五入取整,floor为向下取整。

mysql> select ceil(2.44),round(2.44),floor(2.44);
+————+————-+————-+
| ceil(2.44) | round(2.44) | floor(2.44) |
+————+————-+————-+
|          3 |           2 |           2 |
+————+————-+————-+
1 row in set (0.00 sec)

mysql> select ceil(2.55),round(2.55),floor(2.55);
+————+————-+————-+
| ceil(2.55) | round(2.55) | floor(2.55) |
+————+————-+————-+
|          3 |           3 |           2 |
+————+————-+————-+
1 row in set (0.00 sec)

 

 

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注

滚动至顶部