What is the average salary of all teams?
select avg(salary) from salary
What about for each team?
select t1.name, avg(t2.salary) from team as t1 join salary as t2 on t1.team_id = t2.team_id group by t1.team_id;
Can you order the results by average salary?
select t1.name, avg(t2.salary) from team as t1 join salary as t2 on t1.team_id = t2.team_id group by t1.team_id order by avg(t2.salary)
Please give the first one with its name and id.
select t1.name, t1.team_id from team as t1 join salary as t2 on t1.team_id = t2.team_id group by t1.team_id order by avg(t2.salary) asc limit 1;