I am wondering if there is a method to implement SQL analytic functions without using the inbuilt functions.
SELECT *,
ROW_NUMBER() OVER (PARTITION BY dept_id ORDER BY salary DESC) AS rownum,
DENSE_RANK() OVER (PARTITION BY dept_id ORDER BY salary DESC) AS denserank,
RANK() OVER (PARTITION BY dept_id ORDER BY salary DESC) AS rnk
FROM emp;
See Question&Answers more detail:os