思路:首先查詢出學號為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