展开全部
1、创建测试表,
create table test_score(class_id varchar2(20), student_id varchar2(20), score number);

2、插入测试数据
insert into test_score values ('C07', 1001, 50);
insert into test_score values ('C07', 1002, 72);
insert into test_score values ('C07', 1003, 85);
insert into test_score values ('C07', 1004, 91);
insert into test_score values ('C07', 1005, 48);
insert into test_score values ('C07', 1006, 79);
insert into test_score values ('C07', 1007, null);

3、查询表e69da5e6ba9062616964757a686964616f31333431373864的记录,select t.*, rowid from test_score t;

4、编写sql,查询某某课程及格的总人数以及不及格的总人数以及没成绩的人数,
select class_id,
count(distinct case when score < 60 then student_id end) s1,
count(distinct case when score >= 60 then student_id end) s2,
count(distinct case when score is null then student_id end) s3
from test_score t group by class_id,
