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

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