Sort by

recency

|

1901 Discussions

|

  • + 0 comments

    with required_table as ( select s.id,s.name,friend_id as bf,salary from students s join friends f on s.id = f.id join packages p on s.id = p.id ) select t1.name from required_table t1 join required_table t2 on t1.bf = t2.id where t2.salary > t1.salary order by t2.salary

  • + 0 comments

    With friendsalary as ( select d.ID, d.Friend_ID, p.Salary from Friends d join Packages p on d.Friend_ID = p.ID ),

    studentsalary as ( select s.ID,s.Name, p1.Salary from Students s join Packages p1 ON s.ID = p1.ID ) select ss.Name from studentsalary ss join friendsalary fs on ss.ID = fs.ID where ss.Salary < fs.Salary order by fs.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

    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;