-- Employees per department, ranked in salary order SELECT EMPNO, DEPTNO, SAL, rank() OVER (PARTITION BY DEPTNO ORDER BY SAL) AS MYRANK FROM EMP;