日期:2014-05-16 浏览次数:20495 次
select sname
from student
where not exists (select *
from course
where not exists (select *
from sc
where sno = sc.sno
and sc.cno = course.cno))思路2:select Sname
from student
where Sno IN (select Sno
from SC
group by Sno /*根据Sno分组,统计每个学生选修了几门课程。如果等于course的总数,就是我们要找的Sno*/ having count(*) = (select count(*) from course)) /*统计course中共有几门课程*/SELECT DISTINCT Sno
FROM SC SCX
WHERE NOT EXISTS (SELECT *
FROM SC SCY
WHERE SCY.Sno=’95002’
AND NOT EXISTS (SELECT *
FROM SC SCZ
WHERE SCZ.Sno=SCX.Sno
AND SCZ.Cno=SCY.Cno))