T.DEPT_NO,
T.DEPT_NAME,
COUNT(DEPT_NO) OVER(PARTITION BY DEPT_NO) AS SN
FROM
(
SELECT
T1.DEPT_NO,
T1.DEPT_NAME,
T3.SALARY
FROM
departments T1
LEFT JOIN
dept_emp T2
ON T1.DEPT_NO = T2.DEPT_NO
LEFT JOIN
salaries T3
ON T2.EMP_NO = T3.EMP_NO
)T
ORDER BY T.DEPT_NO