Oracle数据库之SQL语句练习(3)

发表于:2013-05-31来源:Csdn作者:一个小菜仔点击数: 标签:oracle
思路:首先查询出学号为S001学生所选 的所有课程的信息,之后进行判断 [sql] view plaincopyprint? select t.sno,t.sname ,score.cno from student t left join score on t.sno= scor

  思路:首先查询出学号为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