1 | SELECT * FROM EMP; |
1 2 3 4 5 6 7 | SELECT EMPNO ,ENAME ,dept_no ,SAL , SUM (sal) over( ORDER BY empno) AS dept_cum FROM EMP ORDER BY empno; |
Lets group the Cumulative Sum Based on DepartmentId
1 2 3 4 5 6 7 | SELECT EMPNO ,ENAME ,dept_no ,SAL , SUM (sal) over(PARTITION BY dept_no ORDER BY empno) AS dept_cum FROM EMP ORDER BY empno; |