--查询课程编号以'c05'开头,被3名及以上学生选修
--且期末成绩的平均分高于75分的课程号、选修人数
--和期末成绩平均分,并按平均分降序排序
use teaching
go
select courseno,count(studentno)as '选修人数',avg(final) as '期末平均分'
from score
where courseno like 'c05%' and final is not null
GROUP BY courseno
having COUNT(studentno)>=3 and AVG(final)>75
order by AVG(final) desc