create table 選課表
(
學號 varchar(9) Foreign Key references 學生表(學號),
課程編號 Varchar(8) Foreign Key references 課程表(課程編號),
成績 smallint
)
select * from 選課表 t
where not exists
( select 1 from 選課表 where 學號='200515122' and 課程編號 not in (select 課程編號 from 選課表 where 學號=t.學號))
select distinct 學號 from 選課表 t
where not exists
( select 1 from 選課表 where 學號='200515122' and 課程編號 not in (select 課程編號 from 選課表 where 學號=t.學號))
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。