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