#整体思路:建一个中间表,包含要查询的所有字段以及需要比较的平均值。然后要什么取什么。
select t1.id ,t1.job ,t1.score from (select id,job,score,avg(score)over(partition by job)as avg_score from grade)t1 where t1.score>avg_score order by t1.id;
select t1.id ,t1.job ,t1.score from (select id,job,score,avg(score)over(partition by job)as avg_score from grade)t1 where t1.score>avg_score order by t1.id;