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 first as (select a.id as id,a.name as name ,b.friend_id as friend_id , c.salary as salary from students a inner join friends b on a.id=b.id inner join packages c on b.id=c.id), friend as (select f.friend_id as friend_id,p.salary as friend_salary from friends f inner join packages p on f.friend_id=p.id)
select f.name from first f inner join friend d on f.friend_id=d.friend_id where d.friend_salary > f.salary order by d.friend_salary asc;
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 first as (select a.id as id,a.name as name ,b.friend_id as friend_id , c.salary as salary from students a inner join friends b on a.id=b.id inner join packages c on b.id=c.id), friend as (select f.friend_id as friend_id,p.salary as friend_salary from friends f inner join packages p on f.friend_id=p.id) select f.name from first f inner join friend d on f.friend_id=d.friend_id where d.friend_salary > f.salary order by d.friend_salary asc;