select course_id fromsectionas S where semester='Fall'andyear=2009andexists( select * fromsectionas T where semester ='Spring'andyear=2010and S.course_id= T.course_id );
1 2 3 4 5 6 7 8 9 10 11 12 13
mysql> select course_id from section as S where semester='Fall' and year=2009 and exists( select * from section as T where semester ='Spring' and year=2010 and S.course_id= T.course_id ); +-----------+ | course_id | +-----------+ | CS-101 | +-----------+ 1 row inset
select S.ID,S.name from student as S wherenotexists(( select course_id from course where dept_name ='Biology' ) except ( select T.course_ID from takes as T where S.ID= T.ID ));
找出Biology系开设的所有课程集合
1 2 3
select course_id from course where dept_name ='Biology'