思路:首先查询出学号为S001学生所选
的所有课程的信息,之后进行判断
[sql] view plaincopyprint?
select t.sno,t.sname ,score.cno from student t
left join score on t.sno= score.sno
where score.cno in
(
select distinct cno from score where sno='S001'
)
and t.sno <>'S001'
;
select t.sno,t.sname ,score.cno from student t
left join score on t.sno= score.sno
where score.cno in
(
select distinct cno from score where sno='S001'
)
and t.sno <>'S001'
;
第一阶段的练习就到这儿了。
原文转自:http://blog.csdn.net/kiritor/article/details/8805310