运用窗口函数,先按 job 分组增加一列各课程平均分,再将整个表做为 from 表,where score > avg(score) 就可以
select * from
(select *,avg(score) over(partition by job) as avg_score from grade) t1
where score > avg_score
order by id