第九題:
先獲取01同學(xué)所學(xué)的所有課程編號b們,
(select cid from sc where sid='01') b
問題轉(zhuǎn)化為,查詢b表中課程都學(xué)過的所有學(xué)生sid,有了sid剩下的就好辦啦
所有課程都學(xué)過這個可以用雙重not exist來表達(dá)
select sid
from student
where not exists (
select 1 from (select cid from sc where sid='01') b
where not exists(
select 1 from sc where sc.sid=student.sid and sc.cid=b.cid
)
)