书名:数据库系统概念/作者:Silberschatz,Korth,Sudarshan
问题:找出已经上过ID 10101教师授课的(不同)学生的总数
回答:
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
);
我的疑问:
select count (distinct ID)
from takes
where course_id in (SELECT course_id from teaches where teaches.ID = 10101);
我必须是正确答案吗?