???
group by 잘 몰라서 그냥 넘어감 . 다시 해볼것
sj0020
2021. 7. 17. 13:25
https://thebook.io/006977/ch04/02/05/04-02/
모두의 SQL: RANK, DENSE_RANK, ROW_NUMBER : 데이터 값에 순위 매기기 - 2
thebook.io
SELECT A.employee_id,
A.department_id,
B.department_name,
salary,
-- RANK() OVER(PARTITION BY A.department_id ORDER BY salary DESC) RANK_급여,--
-- DENSE_RANK() OVER(PARTITION BY A.department_id ORDER BY salary DESC) DENSE_RANK_급여,--
-- ROW_NUMBER() OVER(PARTITION BY A.department_id ORDER BY salary DESC) ROW_NUMBER_급여
FROM employees A, departments B
WHERE A.department_id = B.department_id
ORDER BY B.department_id, A.salary DESC;