MySQL語(yǔ)法(數(shù)學(xué)函數(shù))

數(shù)學(xué)函數(shù)

1)abs( ) :取絕對(duì)值
select abs(1.0),abs(-5.3) from dual;

image.png

2)round():四舍五入
select round(1.4999),round(1.5),round(-1.4568,2),round(-53451.4568,-2) from dual;
image.png

3) truncate():截?cái)?br> select truncate(1.4999,2),truncate(1.5,1), truncate(-1.4568,2),truncate(-53451.4568,-2) from dual;
image.png

4)ceil( ) :向上(后)取整
select ceil(1.0001),ceil(1.9), ceil(-221.9),ceil(-1.001) from dual;
image.png

5) floor() :向下(前)取整
select floor(1.0001), floor(1.9), floor(-221.9), floor(-1.001) from dual;
image.png

6)rand( ):隨機(jī)數(shù)
image.png

7)pi( ) :圓周率
image.png

8)mod( ):求余數(shù)
image.png

9)sqrt( ):算術(shù)平方根
select mod(8,3),sqrt(-4),sqrt(5) from dual;
image.png

10)sin( ) :正弦函數(shù)
cos( ) :余弦函數(shù)
tan( ) :正切函數(shù)
select sin(pi()/2),cos(pi()),tan(pi()/4);
image.png

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
禁止轉(zhuǎn)載,如需轉(zhuǎn)載請(qǐng)通過(guò)簡(jiǎn)信或評(píng)論聯(lián)系作者。

友情鏈接更多精彩內(nèi)容