需求描述:
最近寫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