select a.id,a.job, a.score
from
(select id, job, score, avg(score) over(partition by job) avg_score
from grade
order by id) a
where a.score > a.avg_score
  • 使用窗口函数得到平均分数
  • 使用子查询得到结果