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,F.Friend_ID
FROM Students AS S
INNER JOIN Packages AS P ON S.ID=P.ID
INNER JOIN Friends AS F ON S.ID=F.ID
)
, CTE2 AS(
SELECT CTE.Name AS StudentName, CTE.Salary AS StudentSalary, Students.Name AS FriendName, Packages.Salary AS FriendSalary
FROM CTE INNER JOIN Students ON CTE.Friend_ID=Students.ID
INNER JOIN Packages ON Packages.ID=CTE.Friend_ID
)
, CTE3 AS(
SELECT CASE
WHEN StudentSalary
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 AS( SELECT S.ID, S.Name, P.Salary,F.Friend_ID FROM Students AS S INNER JOIN Packages AS P ON S.ID=P.ID INNER JOIN Friends AS F ON S.ID=F.ID ) , CTE2 AS( SELECT CTE.Name AS StudentName, CTE.Salary AS StudentSalary, Students.Name AS FriendName, Packages.Salary AS FriendSalary FROM CTE INNER JOIN Students ON CTE.Friend_ID=Students.ID INNER JOIN Packages ON Packages.ID=CTE.Friend_ID ) , CTE3 AS( SELECT CASE WHEN StudentSalary