首页 > 代码库 > mysql-向上,向下,四舍五入-取整函数
mysql-向上,向下,四舍五入-取整函数
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)
其中ceil为向上取整,round为四舍五入取整,floor为向下取整。
本文出自 “Chocolee” 博客,请务必保留此出处http://chocolee.blog.51cto.com/8158455/1550344
mysql-向上,向下,四舍五入-取整函数