SQL Service数据查询操作 统计每门课程的选课人数及不及格人数
答案:1 悬赏:10
解决时间 2021-03-15 01:15
- 提问者网友:蓝莓格格巫
- 2021-03-14 12:12
SQL Service数据查询操作 统计每门课程的选课人数及不及格人数
最佳答案
- 二级知识专家网友:迟山
- 2021-03-14 12:41
select c.cnum,
c.cname,
count(1) "选课人数",
sum(case
when sc.score < 60 then
1
else
0
end) "不及格人数"
from course c, sections s, sc
where s.cnum = c.cnum
and sc.secnum = s.secnum
group by c.cnum, c.cname
c.cname,
count(1) "选课人数",
sum(case
when sc.score < 60 then
1
else
0
end) "不及格人数"
from course c, sections s, sc
where s.cnum = c.cnum
and sc.secnum = s.secnum
group by c.cnum, c.cname
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯