1.根据两个表的 emp_no inner join 成一个新表;
2.然后根据 title 分组,求其平均值,过滤出相应字段,再根据平均薪水升序排序
select title,avg(salary) avg_salary from (select * from titles) a inner join (select * from salaries) b on a.emp_no = b.emp_no group by title order by avg_salary
1.根据两个表的 emp_no inner join 成一个新表;
2.然后根据 title 分组,求其平均值,过滤出相应字段,再根据平均薪水升序排序
select title,avg(salary) avg_salary from (select * from titles) a inner join (select * from salaries) b on a.emp_no = b.emp_no group by title order by avg_salary