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.
Good solution, MINE LOOKS MORE length with sub queries..
SELECT s1.name
FROM (SELECT s.id, s.name, p.salary FROM students s JOIN packages p ON s.id = p.id) s1
JOIN
(SELECT f.id , f.friend_id, p.salary FROM friends f JOIN packages p ON f.friend_id = p.id) f1
ON s1.id = f1.id
WHERE s1.salary < f1.salary
ORDER BY f1.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 →
Good solution, MINE LOOKS MORE length with sub queries.. SELECT s1.name FROM (SELECT s.id, s.name, p.salary FROM students s JOIN packages p ON s.id = p.id) s1 JOIN (SELECT f.id , f.friend_id, p.salary FROM friends f JOIN packages p ON f.friend_id = p.id) f1 ON s1.id = f1.id WHERE s1.salary < f1.salary ORDER BY f1.salary;