统计各科成绩各分数段人数:课程编号,课程名称,[100-85],[85-70],[70-60],[0-60]及所占百分比

SELECT c.c_id 课程ID,c.c_name 课程NAME,
a.vv 不及格率,b.cc 中等率,c.ww 优良率,d.aa 优秀率
FROM score s,course c,
(SELECT a.cou/b.co vv FROM(SELECT c_id ,COUNT(c_id) cou FROM score WHERE s_score <60 GROUP BY c_id) a,(SELECT c_id ,COUNT(c_id) co FROM score GROUP BY c_id) b WHERE a.c_id=b.c_id) a,
(SELECT a.cou/b.co cc FROM(SELECT c_id ,COUNT(c_id) cou FROM score WHERE s_score >=60 AND s_score <70 GROUP BY c_id) a,(SELECT c_id ,COUNT(c_id) co FROM score GROUP BY c_id) b WHERE a.c_id=b.c_id) b,
(SELECT a.cou/b.co ww FROM(SELECT c_id ,COUNT(c_id) cou FROM score WHERE s_score >=70 AND s_score <85 GROUP BY c_id) a,(SELECT c_id ,COUNT(c_id) co FROM score GROUP BY c_id) b WHERE a.c_id=b.c_id) c,
(SELECT a.cou/b.co aa FROM(SELECT c_id ,COUNT(c_id) cou FROM score WHERE s_score >85 GROUP BY c_id) a,(SELECT c_id ,COUNT(c_id) co FROM score GROUP BY c_id) b WHERE a.c_id=b.c_id) d
WHERE s.c_id=c.c_id GROUP BY s.c_id

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值