select t2.sno from (select t1.* (select sno,avg(grade) pjf from sc group by sno) t1 order by pjf desc) t2 where rownum=1
如果考虑多名学生并列第一且全部列出,则: select t2.sno from t2 where t2.pjf in (select t2.pjf from (select t1.* (select sno,avg(grade) pjf from sc group by sno) t1 order by pjf desc) t2 where rownum=1)
select sno from (select sno, avg(grade)ag from sc group by sno order by ag desc) where rownum=1
2.对分组后的数据算平均值 用avg()函数;然后取最大值
(select t1.*
(select sno,avg(grade) pjf from sc group by sno) t1
order by pjf desc) t2
where rownum=1
select t2.sno from t2 where t2.pjf in
(select t2.pjf from
(select t1.*
(select sno,avg(grade) pjf from sc group by sno) t1
order by pjf desc) t2
where rownum=1)
where rownum=1