日期:2014-05-17  浏览次数:20775 次

两个not exist问题
学生表(学号,名字)student(sno,sname)
选课表(学号,课程号)sc(sno,cno)
课程表(课程号,课程名)course(cno,cname)
注:不是每个学生都会选课
查询选修了全部课程的学生姓名
书上的代码为
select sname
from student
where not exists
  (select *
  from course
  where not exists
  (select *
  from sc
  where sno=student.sno
  and cno=course.cno))