思路如下:
1.首先子查询 得到每个职业的平均成绩
select job,avg(score) avg_s from grade group by job
2.查询grade中的id,job和分数,要求同job下分数大于子查询中的avg
3.最后利用id排序即可
select id,g.job,score from grade g,(select job,avg(score) avg_s
from grade group by job) s
where g.job = s.job and g.score>s.avg_s
order by id