We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
SELECT s.Name
FROM Students s
JOIN Friends f ON s.ID = f.ID
JOIN Packages p_self ON s.ID = p_self.ID
JOIN Packages p_friend ON f.Friend_ID = p_friend.ID
WHERE p_friend.Salary > p_self.Salary
ORDER BY p_friend.Salary;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Placements
You are viewing a single comment's thread. Return to all comments →
V E R Y E A S Y S O L U T I O N
SELECT s.Name FROM Students s JOIN Friends f ON s.ID = f.ID JOIN Packages p_self ON s.ID = p_self.ID JOIN Packages p_friend ON f.Friend_ID = p_friend.ID WHERE p_friend.Salary > p_self.Salary ORDER BY p_friend.Salary;