select distinct sno from sc scx
where not exists
(select 1 from sc scy
where scy.sno='112' and
not exists
(select 1 from sc scz
where scz.sno=scx.sno and
scz.sno=scy.sno));
#2
select t.sno
from sc t
where t.cno >= all (select m.cno from sc m where m.sno = '112')
and t.sno <> '112'
一定是學生啦,大學的數據庫書上就這么一個例子~~
#3
select sno from sc where sc.cno in(select cno from sc where sno = '112');
#4
至少是有一個就行還是必須包含所有的?
#5
select sno from sc where sc.cno in(select cno from sc where sno = '112');