首页 > Linux操作系统 > Linux操作系统 > Oracle常用分析函數
select deptno,EMPNO,ENAME ,sal,
rank() over(partition by deptno order by empno) seq
from emp;
DEPTNO EMPNO ENAME SAL SEQ
---------- ---------- ---------- ---------- ----------
10 1000 JJ 3000 1
10 1000 xx 1
10 7781 3
10 7781 3
10 7781 CLARK 2572.5 3
10 7782 CLARK 2450 6
10 7839 KING 5000 7
10 7934 MILLER 1300 8
20 7566 JONES 2975 1
20 7788 SCOTT 3000 2
20 7876 ADAMS 1100 3DENSE_RANK
select deptno,EMPNO,ENAME ,sal,
dense_rank() over(partition by deptno order by empno) seq
from emp;
DEPTNO EMPNO ENAME SAL SEQ
---------- ---------- ---------- ---------- ----------
10 1000 JJ 3000 1
10 1000 xx 1
10 7781 2
10 7781 2
10 7781 CLARK 2572.5 2
10 7782 CLARK 2450 3
10 7839 KING 5000 4
10 7934 MILLER 1300 5
20 7566 JONES 2975 1
20 7788 SCOTT 3000 2
20 7876 ADAMS 1100 3来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10314474/viewspace-660370/ ,如需转载,请注明出处,否则将追究法律责任。