正确结果贴出来看看 TRY: SELECT CNO FROM TT WHERE SNO='103' GROUP BY CNO
select distinct sno from sc x where not exists (select * from sc y where y.sco=103 and not exists (select * from sc z where z.sno=x.sno and z.cno=y.cno)) 很久以前学得了,现在突然领悟不了了,郁闷...
书上的题目啊[align=center]====思想重于技巧==== [/align]
解释一下: not exists (select * from sc y where y.sco=103 and not exists (select * from sc z where z.sno=x.sno and z.cno=y.cno))not exists不存在(103所学的课程,但其它学生未学的not exists (select * from sc z)也就是103学了这门课,原这门课不存在于这个学生的课程中 [align=center]====思想重于技巧==== [/align]
TRY:
SELECT CNO FROM TT WHERE SNO='103' GROUP BY CNO
where not exists
(select * from sc y
where y.sco=103 and not exists
(select * from sc z
where z.sno=x.sno and z.cno=y.cno))
很久以前学得了,现在突然领悟不了了,郁闷...
书上的题目啊[align=center]==== 思想重于技巧 ====
[/align]
not exists
(select * from sc y
where y.sco=103 and not exists
(select * from sc z
where z.sno=x.sno and z.cno=y.cno))not exists不存在(103所学的课程,但其它学生未学的not exists
(select * from sc z)也就是103学了这门课,原这门课不存在于这个学生的课程中
[align=center]==== 思想重于技巧 ====
[/align]
[align=center]==== 思想重于技巧 ====
[/align]