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 As (
Select S.ID,S.Name,P.Salary
From Students As S
Join Packages As P
On S.ID = P.ID
)
,
CteFriend As (
Select C.* ,F.Friend_ID
From Cte As C
Join Friends As F
On C.ID = F.ID
)
Select Name
from CteFriend As Cf
Join Packages As P
On Cf.Friend_ID = P.ID
Where Cf.Salary < P.Salary
Order by p.Salary
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Placements
You are viewing a single comment's thread. Return to all comments →
With Cte As ( Select S.ID,S.Name,P.Salary From Students As S Join Packages As P On S.ID = P.ID ) , CteFriend As ( Select C.* ,F.Friend_ID From Cte As C Join Friends As F On C.ID = F.ID
) Select Name from CteFriend As Cf Join Packages As P On Cf.Friend_ID = P.ID Where Cf.Salary < P.Salary Order by p.Salary