Oracle 的 函數

目錄

sum()over()函數

NVL(expr1,expr2)函數

sql之left join、right join、inner join的區別

to_char() 函數


Round函數用法:

截取數字 
格式如下:ROUND(number[,decimals])
其中:number 待做截取處理的數值
decimals 指明需保留小數點後面的位數。可選項,忽略它則截去所有的小數部分,並四捨五入。如果爲負數則表示從小數點開始左邊的位數,相應整數數字用0填充,小數被去掉。需要注意的是,和trunc函數不同,對截取的數字要四捨五入。
舉例如下:

Sql代碼:

SQL>   select   round(1234.5678,4)   from   dual;

ROUND(1234.5678,4)
——————
1234.5678

SQL>   select   round(1234.5678,3)   from   dual;

ROUND(1234.5678,3)
——————
1234.568

SQL>   select   round(1234.5678,2)   from   dual;

ROUND(1234.5678,2)
——————
1234.57

SQL>   select   round(1234.5678,1)   from   dual;

ROUND(1234.5678,1)
——————
1234.6

SQL>   select   round(1234.5678,0)   from   dual;

ROUND(1234.5678,0)
——————
1235

SQL>   select   round(1234.5678,-1)   from   dual;

ROUND(1234.5678,-1)
——————-
1230

SQL>   select   round(1234.5678,-2)   from   dual;

ROUND(1234.5678,-2)
——————-
1200

SQL>   select   round(1234.5678,-3)   from   dual;

ROUND(1234.5678,-3)
——————-
1000

附加:

SQL>   select   round(45.923,-1)   from   dual;

ROUND(45.923,-1)
——————-
50

sum()over()函數

sum(…) over( ),對所有行求和

sum(…) over( order by … ), 連續求和

sum(…) over( partition by… ),同組內所行求和

sum(…) over( partition by… order by … ),同第1點中的排序求和原理,只是範圍限制在組內
--------------------- 
參考https://blog.csdn.net/yangshangwei/article/details/52985553

NVL(expr1,expr2)函數

參考https://www.cnblogs.com/zrui-xyu/p/4819712.html

sql之left join、right join、inner join的區別

參考https://blog.csdn.net/u013991521/article/details/80531885

to_char() 函數

https://www.cnblogs.com/aipan/p/7941917.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章