班级考试人数大于10、班级最低分在50分以上、计算机学院、班级平均分从高到低前10名

阅读 85

2022-05-15

/*表scores有四个字段,学生stu、班级class、学院institute、分数score。 

要求返回:班级考试人数大于10、班级最低分在50分以上、计算机学院、班级平均分从高到低前10名。

可以用任意数据库写SQL 返回字段为班级,平均分。*/


--不准嵌套语句。

select top 10 class,平均分=avg(score) from tb  
where institute='计算机学院'
group by class
having count(1)>=10 and min(score)>=50
order by avg(score) desc






精彩评论(0)

0 0 举报