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 friendsalary as (
select d.ID, d.Friend_ID, p.Salary
from Friends d
join Packages p on d.Friend_ID = p.ID
),
studentsalary as (
select s.ID,s.Name, p1.Salary
from Students s
join Packages p1 ON s.ID = p1.ID
)
select ss.Name
from studentsalary ss
join friendsalary fs on ss.ID = fs.ID
where ss.Salary < fs.Salary
order by fs.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 friendsalary as ( select d.ID, d.Friend_ID, p.Salary from Friends d join Packages p on d.Friend_ID = p.ID ),
studentsalary as ( select s.ID,s.Name, p1.Salary from Students s join Packages p1 ON s.ID = p1.ID ) select ss.Name from studentsalary ss join friendsalary fs on ss.ID = fs.ID where ss.Salary < fs.Salary order by fs.Salary ;