这一篇是对前面所有关于分析函数的文章的总结:
一、统计方面:
复制代码 代码如下: 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开发之报表函数》
以上就是oracle分析函数总结的全部内容,希望能给大家一个参考,也希望大家多多支持www.887551.com。