知识点
- 使用group by进行分组
- 聚合函数写在select后
代码
select title, avg(salary)
from titles t
join salaries s
on t.emp_no = s.emp_no
group by title
order by avg(salary)
select title, avg(salary)
from titles t
join salaries s
on t.emp_no = s.emp_no
group by title
order by avg(salary)