先按照job 分组然后统计每个分组的求和除以统计个数、然后保留小数3位。再按照平均分排序
-- select job|avg(1.0*score) from grade group by job ;
select job , round((1.0*sum(score)/count(id) ),3) as a from grade group by job order by a desc ;
先按照job 分组然后统计每个分组的求和除以统计个数、然后保留小数3位。再按照平均分排序
-- select job|avg(1.0*score) from grade group by job ;
select job , round((1.0*sum(score)/count(id) ),3) as a from grade group by job order by a desc ;