Sort by

recency

|

1893 Discussions

|

  • + 0 comments
    with cte as(
    select friends.friend_id as fID,packages.salary sly from friends
    inner join packages
    on friends.friend_id=packages.id
    )
    
    select name as nm from friends
    inner join cte
    on friends.friend_id=cte.fID
    inner join students
    on students.id=friends.id
    inner join packages
    on friends.id=packages.id
    where cte.sly>packages.salary
    order by cte.sly ASC
    
  • + 0 comments

    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

  • + 0 comments

    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;

  • + 0 comments

    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;

  • + 0 comments
        cte AS (SELECT a.id id, a.friend_id fid, b.name name, c.salary sly FROM Friends a
            INNER JOIN Students b ON a.friend_id = b.id
            INNER JOIN Packages c ON a.friend_id = c.id)
    SELECT a.name FROM Students a
    INNER JOIN cte b ON a.id = b.id
    INNER JOIN Packages c ON a.id = c.id
    WHERE c.salary < b.sly
    ORDER BY b.sly;