RANK() 参数及形式完全与上同,二区最大的区别是:RANK函数在处理指定数值在记录集中的排序值时,如果值有重复,则后面的排序值会跳过这个值,直接从当前排序值+重复记录数开始,而DENSE_RANK则不会,排序值依然是个连续的序列。
select scott.emp.ename,scott.emp.deptno, scott.emp.sal,rank()over(partition by scott.emp.deptno order by scott.emp.sal) from scott.emp
select scott.emp.ename,scott.emp.deptno, scott.emp.sal,dense_rank()over(partition by scott.emp.deptno order by scott.emp.sal) from scott.emp