针对上一题中的关系,查询至少选修了“201815005”同学所选课程的学生的姓名,可以使用如下SQL语句。select sname from student swhere sno[]‘201815005’ and not exists (select * from sc x where x.sno='201815005' and not exists (select * from sc y where y.cno=x.cno and y.sno=s.sno ) )
举一反三
- 针对上一题中的关系,查询至少选修了“201815005”同学所选课程的学生的姓名,可以使用如下SQL语句。select sname from student swhere sno<>‘201815005’ and not exists (select * from sc x where x.sno='201815005' and not exists (select * from sc y where y.cno=x.cno and y.sno=s.sno ) ) A: 正确 B: 错误
- 在学生选课数据库中有学生表student(sno,sname,ssex,sage,sdept),课程表course(cno,cname)及学生选课表sc(sno,cno,grade),其中sno是学号,sname是姓名,ssex是性别,sage是年龄,sdept是系别,cno是课程号,cname是课程名,grade是成绩。查询至少选修了“201815005”同学所选课程的学生的姓名,可以使用如下SQL语句。select sname from student swhere sno[]‘201815005’ and not exists (select * from sc x where x.sno='201815005' and not exists (select * from sc y where y.cno=x.cno and y.sno=s.sno ) )
- 在学生选课数据库中有学生表student(sno,sname,ssex,sage,sdept),课程表course(cno,cname)及学生选课表sc(sno,cno,grade),其中sno是学号,sname是姓名,ssex是性别,sage是年龄,sdept是系别,cno是课程号,cname是课程名,grade是成绩。查询至少选修了“201815005”同学所选课程的学生的姓名,可以使用如下SQL语句。select sname from student swhere sno<>‘201815005’ and not exists (select * from sc x where x.sno='201815005' and not exists (select * from sc y where y.cno=x.cno and y.sno=s.sno ) ) A: 正确 B: 错误
- 针对上一题中的关系,查询至少选修了“201715002”同学所选课程的学生的姓名,可以使用如下SQL语句。select sname from swhere sno[]‘201715002’ and not exists (select * from sc x where x.sno='201715002' and not exists (select * from sc y where y.cno=x.cno and y.sno=s.sno ) )
- 在学生选课数据库中,检索被全部学生所选修的课程的SQL可以描述为( ) A: SELECT Cno FROM SC WHERE (Select Count(Sno) FROM SC GROUP BY Cno) = (SELECT Count(*) FROM Student) ; B: SELECT Cno FROM SC x WHERE NOT EXISTS (SELECT * FROM Student s WHERE NOT EXISTS (SELECT * FROM SC y WHERE x.Cno = y.Cno AND s.Sno= y.Sno); C: SELECT Cno FROM SC x WHERE NOT EXISTS (( SELECT Sno FROM Student) EXCEPT ( SELECT y.Sno FROM SC y, Student z WHERE x.Cno=y.Cno AND z.Sno=y.Sno)); D: 以上答案都不对