首页 > 数据库技术 > 详细

mysql中floor函数的作用是什么?

时间:2018-06-26 13:42:32      阅读:291      评论:0      收藏:0      [点我收藏+]

需求描述:

  最近写mysql程序的时候,使用了floor函数,在此记录下该函数的作用

操作过程:

1.使用floor函数的测试

mysql> select floor(1.23),floor(-1.23);
+-------------+--------------+
| floor(1.23) | floor(-1.23) |
+-------------+--------------+
|           1 |           -2 |
+-------------+--------------+
1 row in set (0.00 sec)

备注:根据官方文档的提示,floor函数返回小于等于该值的最大整数.

示意图:

技术分享图片

官方文档参考:

FLOOR(X)

Returns the largest integer value not greater than X.

mysql> SELECT FLOOR(1.23), FLOOR(-1.23);
        -> 1, -2

For exact-value numeric arguments, the return value has an exact-value numeric type. 
For string or floating-point arguments, the return value has a floating-point type. 注意:标记为黄色的部分还没有完全弄清楚.

 

文档创建时间:2018年6月26日13:19:04

mysql中floor函数的作用是什么?

原文:https://www.cnblogs.com/chuanzhang053/p/9228633.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!