group by === having === order by

--15.  找出平均成绩在85分以上的学生,结果按系分组,并按平均成绩的升序排列;
select sdept,sc.sno,avg(grade)
from sc,student
where sc.sno=student.sno
group by sc.sno,sdept
having avg(grade)>85
order by avg(grade)
go

posted @ 2014-04-28 13:55  a12436109  阅读(198)  评论(0编辑  收藏  举报