728x90
https://www.hackerrank.com/challenges/placements/problem?isFullScreen=true
Placements | HackerRank
Write a query to output the names of those students whose best friends got offered a higher salary than them.
www.hackerrank.com
베스트 프렌드가 자신보다 더 높은 salary를 받는 학생들의 이름을 출력.
베스트 프렌드가 받는 salary를 오름차순으로 정렬.
(동일한 값의 salary는 없음)
select s.name
from students s
left join friends f on s.id = f.id
left join packages p on s.id = p.id
left join packages pp on f.friend_id = pp.id
where p.salary < pp.salary
order by pp.salary
728x90
'𝙎𝙌𝙇' 카테고리의 다른 글
[HackerRank] Interviews (0) | 2023.08.03 |
---|---|
[HackerRank] Symmetric Pairs (0) | 2023.08.02 |
[HackerRank] SQL Project Planning (0) | 2023.07.26 |
[HackerRank] Contest Leaderboard (0) | 2023.07.13 |
[HackerRank] Challenges (0) | 2023.07.12 |