分数大于其所在工作(job)分数的平均分的所有grade属性
考试分数(二)
https://www.nowcoder.com/practice/f456dedf88a64f169aadd648491a27c1
/*1、并表 select id, job, score from grade left join (select job,avg(score) avg from grade group by job) t using(job) where score>avg order by id 2、where子查询 select t.id,t.job,t.score from grade t where score>(select avg(score) from grade t1 where t.job=t1.job group by t1.job) order by t.id 3、窗口函数:where语句需写在外层查询中,写在内层查询会报错。 */ select t.id,t.job,t.score from ( select *, avg(score) over(partition by job) avg from grade ) t where t.score>t.avg order by t.id