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


需求描述:

  最近寫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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM