标签:spec ati 总计 com 汇总 text order by 参数 ora
目录导航:
function_name(<argument>,<argument>...) over(<partition_Clause><order by_Clause><windowing_Clause>);
function_name():函数名称
argument:参数
over( ):开窗函数
partition_Clause:分区子句,数据记录集分组,group by...
order by_Clause:排序子句,数据记录集排序,order by...
windowing_Clause:开窗子句,定义分析函数在操作行的集合,三种开窗方式:rows、range、Specifying
SELECT deptno,ename,sal,count(*) over() FROM emp --总计数
SELECT deptno,ename,sal,count(*) over(order by deptno) FROM emp --递加计数
select deptno,ename,sal,count(*) over(partition by deptno) from emp --分组计数
select deptno,ename,sal,count(*) over(partition by deptno order by ename) from emp --分组递加计数
select deptno,ename,sal,sum(sal) over() from emp --总累计求和
select deptno,ename,sal,sum(sal) over(order by deptno,ename) from emp --递加累计求和
select deptno,ename,sal,sum(sal) over(partition by deptno) from emp --分组累计求和
select deptno,ename,sal,sum(sal) over(partition by deptno order by deptno,ename) from emp --分组递加累计求和
select deptno,ename,sal,avg(sal) over() from emp --总平均值
select deptno,ename,sal,avg(sal) over(order by deptno,ename) from emp --递加求平均值
select deptno,ename,sal,avg(sal) over(partition by deptno) from emp --分组求平均值
select deptno,ename,sal,avg(sal) over(partition by deptno order by deptno,ename) from emp --分组递加求平均值
select deptno,ename,sal,min(sal) over() from emp --求总最小值
select deptno,ename,sal,min(sal) over(order by deptno,ename) from emp --递加求最小值
select deptno,ename,sal,min(sal) over(partition by deptno) from emp --分组求最小值
select deptno,ename,sal,min(sal) over(partition by deptno order by deptno,ename) from emp --分组递加求最小值
select deptno,ename,sal,max(sal) over() from emp --求总最大值
select deptno,ename,sal,max(sal) over(order by deptno,ename) from emp --递加求最大值
select deptno,ename,sal,max(sal) over(partition by deptno) from emp --分组求最大值
select deptno,ename,sal,max(sal) over(partition by deptno order by deptno,ename) from emp --分组递加求最大值
标签:spec ati 总计 com 汇总 text order by 参数 ora
原文地址:https://www.cnblogs.com/LuckyZLi/p/12264525.html