Sort by

recency

|

1899 Discussions

|

  • + 0 comments

    SELECT s.name FROM students s JOIN friends f ON s.id=f.id JOIN packages p1 ON s.id = p1.id JOIN packages p2 ON f.friend_id = p2.id WHERE p2.Salary > p1.Salary ORDER BY p2.Salary;

  • + 0 comments

    select s.name from students s join friends f on s.id=f.id join packages p1 on s.id = p1.id join packages p2 on f.friend_id = p2.id where p2.Salary > p1.Salary order by p2.Salary;

  • + 0 comments
    with t1 as(
    select s.id, s.name, f.friend_id from students s join friends f on s.id = f.id
    ),
    t2 as(
        select t1.id, t1.name, t1.friend_id, p.salary from t1 join packages p on t1.id = p.id
    )
    select t2.name from t2 join packages p on t2.friend_id = p.id where t2.salary<p.salary order by p.salary;
    
  • + 0 comments

    with friend_sal as ( select f.id,f.friend_id,p.salary from friends f join packages p on f.friend_id = p.id
    ),stud_sal as ( select s.id,s.name,p1.salary from students s join packages p1
    on s.id = p1.id ) select ss.name from stud_sal ss join friend_sal fs ON ss.id = fs.id where fs.salary > ss.salary order by fs.salary

  • + 0 comments
    select a.Name from Students as a
    join Friends as b on a.ID = b.ID
    join Packages as c on a.ID = c.ID
    join Packages as d on b.Friend_ID = d.ID
    where c.Salary < d.Salary
    order by d.salary;