selectdistinct course_id fromsection where semester='Fall'andyear= 2009and course_id in ( select course_id fromsection where semester='Spring'andyear = 2010 );
1 2 3 4 5 6 7 8 9 10 11 12 13
mysql> select distinct course_id from section where semester='Fall' and year= 2009 and course_id in ( select course_id from section where semester='Spring' and year = 2010 ); +-----------+ | course_id | +-----------+ | CS-101 | +-----------+ 1 row inset
selectcount(distinctID) from takes where (course_id, sec_id, semester, year) in ( select course_id, sec_id, semester,year from teaches where teaches.ID=10101 );
1 2 3 4 5 6 7 8 9 10 11 12 13
mysql> select count(distinct ID) from takes where (course_id, sec_id, semester, year) in ( select course_id, sec_id, semester,year from teaches where teaches.ID=10101 ); +--------------------+ | count(distinct ID) | +--------------------+ | 6 | +--------------------+ 1 row inset