SELECT
c.Cid 课程编号,
c.Cname 课程名称,
MAX(s.score) 最高分,
min(s.score) 最低分,
AVG(s.score) 平均分,
count( score >= 60 OR NULL ) / count( s.cid ) * 100 '及格率',
count( score >= 70 AND score < 80 OR NULL ) / count( s.cid ) * 100 '中等率',
count( score >= 80 AND score < 90 OR NULL ) / count( s.cid ) * 100 '优良率',
count( score >= 90 OR NULL ) / count( s.cid ) * 100 '优秀率'
from
course c
LEFT JOIN sc s ON c.Cid = s.Cid
GROUP BY
c.Cid
写的是什么鬼啊