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.
- Prepare
- SQL
- Advanced Join
- Placements
- Discussions
Placements
Placements
Sort by
recency
|
1893 Discussions
|
Please Login in order to post a comment
select T.Name from (select S.NAME,J.FRIEND_ID,P.Salary from students S inner join friends J on S.ID=J.ID inner join Packages P ON S.ID=P.ID ) T inner join students Q on T.FRIEND_ID=Q.ID inner join Packages PK ON T.FRIEND_ID=PK.ID WHERE T.Salary
select s.name from friends f join students s on f.id = s.id join students t on f.friend_ID = t.id join packages p on f.id = p.id join packages k on f.friend_ID = k.id where p.salary < k.salary order by k.salary;
SELECT Students.Name FROM ( SELECT Friends.ID, Friends.Friend_ID, Packages.Salary as Friend_Salary FROM Friends JOIN Packages ON Packages.ID = Friends.Friend_ID) as a JOIN Students ON a.ID = Students.ID JOIN Packages ON a.ID = Packages.ID WHERE a.Friend_Salary > Packages.Salary ORDER BY a.Friend_Salary ASC;