Oracle开发之分析函数总结
更新时间:2016年05月26日 11:47:54 作者:Paul Lin
本文是对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 )
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 ])
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 ))
Rows Between Preceding And Following ))
具体请参考《Oracle开发之窗口函数》
五、相邻记录之间比较方面:
复制代码 代码如下:
Lag(Sum(), 1) Over([Patition by ] [Order by ])
具体请参考《Oracle开发之报表函数》
以上就是Oracle分析函数总结的全部内容,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
删除EM,强制结束EM进程后,启动数据库ORA-00119,ORA-00132报错的解决方法
通过emca -deconfig dbcontrol db -repos drop命令删除EM资料库时,很长时间没有删除完成,期间数据库连接数暴涨,达到数据库最大连接数,结果前台及后台均连接不上数据库。强制杀死EM及应用相关进程,关闭数据库后,重启数据库时报:ORA-00119,ORA-00132错误2015-12-12
最新评论