oracle中分析函数
2019-08-12 23:13
260 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_38845271/article/details/99351568
1.1: 字段分区数值汇总
–分析函数 分区
select t.e_no,
t.e_deptno,
t.e_sal,
sum(t.e_sal) over(partition by t.e_deptno) as sumSal, --按部门分区汇总部门员工工资总和不排序
sum(t.e_sal) over(partition by t.e_deptno order by t.e_sal) sumSal2, --按部门分区且排序
sum(t.e_sal) over() sumSal3 --不分区汇总所有工资
from employee t;
1.2 :字段分区后排序
–分析函数 分区排序
select t.e_no,
t.e_deptno,
t.e_sal,
rank() over(partition by t.e_deptno order by t.e_sal) rankSal, --相同e_sal 排名一致且相同的排名一致且 占位
dense_rank() over(partition by t.e_deptno order by t.e_sal) denseSal, --相同e_sal 排名一致 且相同的排名不占位
row_number() over(partition by t.e_deptno order by t.e_sal) rowSal – 相同e_sal 一次排名,不存在并列
from employee t;
相关文章推荐
- 数据库SQL中对查询结果排序排列序号编号,Oracle分析函数 rank,dense_rank,row_number使用和区别
- Oracle过程与函数的区别分析
- Oracle select --分析函数cube(),rollup()
- Oracle 分析函数/窗口函数
- oracle中row_number() over()分析函数用法
- Oracle分析函数参考手册
- oracle分析函数over()
- 数据库--oracle--分析函数OVER ()
- oracle分析函数row_number() over()使用
- Oracle分析函数学习
- Oracle分析函数之开窗函数over()详解
- oracle 分析函数
- 深入探讨:oracle中row_number() over()分析函数用法
- Oracle分析函数-OLAP函数总结
- Oracle分析函数之NTH_VALUE 详解
- Oracle分析函数
- [Oracle]高效的SQL语句之分析函数(一)--sum()
- oracle 每日一题-分析函数的RANGE/ROW窗口
- ORACLE 分析函数
- 超级牛皮的oracle的分析函数over(Partition by...) 及开窗函数