第十五題版主是忘了join一個(gè)course表了吧
select a.cname,b.* from
course a
join
(select cid as 課程號(hào), 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 優(yōu)良率,
sum(case when score >= 90 then 1 else 0 end) / count(score) as 優(yōu)秀率
from sc
group by Cid) b
on a.cid=b.課程號(hào);
MySQL練習(xí)題(一)個(gè)人博客:http://lixiaohui.live 1、測(cè)試表 2、創(chuàng)建測(cè)試數(shù)據(jù) 3、習(xí)題 使用的MySQL版本如下: MySQL屬性屬性值version_compile_...