[HackerRank SQL] Placements


質問リンク
https://www.hackerrank.com/challenges/placements/problem
Code link
https://github.com/JamesJung01/Hackerrank_sql/blob/main/02_Medium/Placements.sql
SELECT s.Name
FROM students AS s 
JOIN friends AS f
    ON s.id = f.id
JOIN packages AS p1
    ON f.id = p1.id
JOIN packages AS p2
    ON f.friend_id = p2.id
WHERE p1.salary < p2.salary
ORDER BY p2.salary;