오라클 정리

RANK() 함수
partition by 그룹 order by 정렬 대상

select department_id, score,
rank() over(partition by department_id order by score) rnk
from
(select 'a' department_id, 10 score from dual
union all
select 'b' department_id, 20 score from dual
union all
select 'a' department_id, 30 score from dual
union all
select 'b' department_id, 15 score from dual
union all
select 'a' department_id, 50 score from dual
union all
select 'b' department_id, 40 score from dual
)

+ Recent posts