用子查询根据job分组并选出每组平均值,通过job连接子查询和原表grade,这样就能在原表基础上每行增加当前job的平均分。然后在where里限制分数大于平均值并最后排一下序就好了

select g.id, g.job, g.score 
from grade as g,
(select job, avg(score) as average from grade
 group by job) as temp
where temp.job = g.job and g.score > temp.average
order by g.id