已知已经创建表emp
select *
from(select deptno,ename,sal,
row_number() over(partition by deptno order by sal desc) rn,
rank() over(partition by deptno order by sal desc) rk,
dense_rank() over(partition by deptno order by sal desc) drk
from emp) where drk<=3;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29366942/viewspace-1062238/ ,如需转载,请注明出处,否则将追究法律责任。