Oracle开发之分析函数总结
这一篇是对前面所有关于分析函数的文章的总结:
一、统计方面:
代码如下:
Sum() Over ([Partition by ] [Order by ]) Sum() Over ([Partition by ] [Order by ] Rows Between Preceding And Following) Sum() Over ([Partition by ] [Order by ] Rows Between Preceding And Current Row) Sum() Over ([Partition by ] [Order by ] Range Between Interval '' 'Day' Preceding And Interval '' 'Day' Following )
具体请参考《Oracle开发之分析函数简介Over用法》和《Oracle开发之窗口函数》
二、排列方面:
代码如下:
Rank() Over ([Partition by ] [Order by ] [Nulls First/Last]) Dense_rank() Over ([Patition by ] [Order by ] [Nulls First/Last]) Row_number() Over ([Partitionby ] [Order by ] [Nulls First/Last]) Ntile() Over ([Partition by ] [Order by ])
具体请参考《Oracle开发之分析函数(Rank, Dense_rank, row_number)》
三、最大值/最小值查找方面:
代码如下:
Min()/Max() Keep (Dense_rank First/Last [Partition by ] [Order by ])
具体请参考《Oracle开发之分析函数(Top/Bottom N、First/Last、NTile)》
四、首记录/末记录查找方面:
代码如下:
First_value / Last_value(Sum() Over ([Patition by ] [Order by ] Rows Between Preceding And Following ))
具体请参考《Oracle开发之窗口函数》
五、相邻记录之间比较方面:
代码如下:
Lag(Sum(), 1) Over([Patition by ] [Order by ])
具体请参考《Oracle开发之报表函数》
相关推荐
Carlos 2016-05-26
异道 2019-01-07
dbcommando 2018-11-04
FenggFocusOracle 2018-03-10
DCLCSDN 2017-09-04
MyOracleFei 2017-01-15
Omega 2016-11-07
cshpanda 2016-11-07
lidongliang 2016-11-07
分支 2016-11-06
oracleKing 2016-10-17
Oraclesand 2014-04-19
编制者 2014-04-02
oraclestudyroad 2012-08-09
LinuxOracleWf 2012-06-14
红尘浪子 2012-03-16
oraclestudyroad 2012-02-03
oracle 2011-04-11