Q8_m
kuber
plain_text
4 years ago
300 B
11
Indexable
select s.name
from students s
inner join packages p1 on s.id = p1.id
inner join friends f on s.id = f.id
inner join packages p2 on f.friend_id = p2.id
/* double inner join to get both the salaries of the person and his/her friend*/
where p1.salary < p2.salary
order by p2.salary asc;Editor is loading...