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.
with friend_salary as (
select p.salary, f.id
from packages as p
inner join friends as f
on p.id = f.friend_id)
SELECT s.name
from students as s
inner join friend_salary as f
on s.id = f.id
inner join packages as p
on s.id = p.id
where p.salary < f.salary
order by f.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 →
with friend_salary as ( select p.salary, f.id from packages as p inner join friends as f on p.id = f.friend_id)
SELECT s.name from students as s inner join friend_salary as f on s.id = f.id inner join packages as p on s.id = p.id where p.salary < f.salary order by f.salary;