본문 바로가기
???

group by 잘 몰라서 그냥 넘어감 . 다시 해볼것

by sj0020 2021. 7. 17.

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;

'???' 카테고리의 다른 글

시간남으면 할것  (0) 2021.01.20
IC 패키지 종류  (0) 2020.12.15
QQ 문자열 입력후 갯수 세기  (0) 2020.08.24
구구단 2단부터 9단까지 while / for  (0) 2020.08.05
???p236 if (!(num % 2))even / odd // negative/ positive num  (0) 2020.08.05