sum(sal) over (partition by deptno) as sum_dept
which is an analytical function and doesn't require a group by clause.
The below query should pull your data.
SELECT EMPNO, ENAME, HIREDATE, DEPTNO, (SELECT SUM (SAL) FROM empTABLE b WHERE a.DEPTNO = B.DEPTNO) SAL_SUM FROM empTABLE a;
,sum(saL) over (partition by deptno) sal
Yes if....op is on database version prior to 8.1.5
Most of the aggregate functions (including SUM, AVG, COUNT, MIN and MAX) have analytic counterparts, that can get the same results without using a GROUP BY clause. PARTITION BY for analytic functions corresponds to GROUP BY in aggregate functions.