窗口函数求平均值,avg(列)over(partition by 分组) select 姓名,科目,成绩, round( avg(成绩)over(partition by 科目),2) as 平均成绩 from 成绩表