考试分数(一)题解
考试分数(一)
http://www.nowcoder.com/questionTerminal/f41b94b4efce4b76b27dd36433abe398
1.首先题目肯定是按工作分组了,那么语句肯定是如下的:
select xxx from grade group by job然后知道分组之后的分数和是
sum(score)求平均数就是
round(sum(score)*1.0/count(id),3) as avg联合再按avg降序排序为:
select job,round(sum(score)*1.0/count(id),3) as avg from grade group by job order by avg desc;