第十五题版主是忘了join一个course表了吧
select a.cname,b.* from
course a
join
(select cid as 课程号, max(score) as 最高分, min(score) as 最低分, avg(score) as 平均分,
sum(case when score >= 60 then 1 else 0 end) / count(score) as 及格率,
sum(case when score >= 70 and score < 80 then 1 else 0 end) / count(score) as 中等率,
sum(case when score >= 80 and score < 90 then 1 else 0 end) / count(score) as 优良率,
sum(case when score >= 90 then 1 else 0 end) / count(score) as 优秀率
from sc
group by Cid) b
on a.cid=b.课程号;
MySQL练习题(一)个人博客:http://lixiaohui.live 1、测试表 2、创建测试数据 3、习题 使用的MySQL版本如下: MySQL属性属性值version_compile_...