oracle 分析函数 - 总结

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 )

二、排列方面:
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 ])

三、最大值/最小值查找方面:
Min()/Max() Keep (Dense_rank First/Last [Partition by ] [Order by ])

四、首记录/末记录查找方面:
First_value / Last_value(Sum() Over ([Patition by ] [Order by ] Rows Between  Preceding And  Following  ))

五、相邻记录之间比较方面:
Lag(Sum(), 1) Over([Patition by ] [Order by ])

 

以上是关于oracle 分析函数 - 总结的主要内容,如果未能解决你的问题,请参考以下文章

oracle 分析函数总结--仅供参考

Oracle SQL常用内置系统函数总结

Oracle总结二

Oracle总结二

Oracle数据库从RMAN备份集片段还原指定单个归档日志进行日志挖掘分析

Oracle数据库索引使用及索引失效总结