SELECT EMPNO, ENAME, SAL, NVL(SAL,0)+LAG(SAL,1,0) OVER (ORDER BY SAL) SUM_SAL
FROM EMP
ORDER BY SAL
EMPNO | ENAME | SAL | SUM_SAL |
7369 | SMITH | 800 | 800 |
7900 | JAMES | 950 | 1750 |
7876 | ADAMS | 1100 | 2050 |
7521 | MORGAN | 1250 | 2350 |
7654 | MARTIN | 1250 | 2500 |
7934 | MILLER | 1300 | 2550 |
7844 | TURNER | 1500 | 2800 |
7499 | SMALL | 1600 | 3100 |
7782 | FOOTE | 2450 | 4050 |
7698 | BLAKE | 2850 | 5300 |
7566 | NORGAARD | 2975 | 5825 |
7788 | SCOTT | 3000 | 5975 |
7902 | LOFSTROM | 3000 | 6000 |
7839 | ELLISON | 5000 | 8000 |