SQL> select e.ename,e.sal,e.deptno,
percent_rank() over(partition by deptno order by sal) p_rank,
PERCENTILE_CONT(0) within group(order by sal)
over(partition by deptno) max_sal ,
PERCENTILE_CONT(0.25) within group(order by sal)
over(partition by deptno) max_sal_25,
PERCENTILE_CONT(0.5) within group(order by sal)
over(partition by deptno) max_sal_50,
PERCENTILE_CONT(0.75) within group(order by sal)
over(partition by deptno) max_sal_75
from emp e;
ENAME SAL DEPTNO P_RANK MAX_SAL MAX_SAL_25 MAX_SAL_50 MAX_SAL_75
---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
MILLER 1300 10 0 1300 1875 2450 3725
CLARK 2450 10 .5 1300 1875 2450 3725
KING 5000 10 1 1300 1875 2450 3725
SMITH 800 20 0 800 1100 2975 3000
ADAMS 1100 20 .25 800 1100 2975 3000
JONES 2975 20 .5 800 1100 2975 3000
SCOTT 3000 20 .75 800 1100 2975 3000
FORD 3000 20 .75 800 1100 2975 3000
JAMES 950 30 0 950 1250 1375 1575
MARTIN 1250 30 .2 950 1250 1375 1575
WARD 1250 30 .2 950 1250 1375 1575
TURNER 1500 30 .6 950 1250 1375 1575
ALLEN 1600 30 .8 950 1250 1375 1575
BLAKE 2850 30 1 950 1250 1375 1575
已选择14行。
Oracle分析函数PERCENTILE(2)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://www.heiqu.com/5520c24524289a66125bc46d848e1c3e.html