SELECT ROW_NUMBER() OVER(ORDER BY A.job, A.name) row_num
, A.*
FROM employee A
ORDER BY A.job, A.name
SELECT ROW_NUMBER() OVER(PARTITION BY A.job ORDER BY A.job, A.ename) ROW_COUNT
, A.*
FROM employee A
ORDER BY A.job, A.name