group by order by

--8.   统计各系学生的人数,结果按升序排列;

select sdept,count(*) as dd

from student

group by sdept

order by dd

go

--9.   按系统计各系学生的平均年龄,结果按降序排列;

select sdept,avg(sage)dd

from student

group by sdept

order by dd desc

go

原文地址:https://www.cnblogs.com/a12436109/p/3696184.html