查询至少选修了两门课程的学生学号的sql语句

第一个:至少选修c1和c2的学生编号
           1.  select sno from sc where sc.cno='c1' and sno in(select sno from sc where cno='c2')
           2.select sno from sc scx,sc scy where scx.sno=scy.sno and scx.cno='c1' and scy.cno='c2'
 
第二个:同时选修c1和c2的学生编号
             select sc.sno from sc where sc.cno = 'c1' intersect select sc.sno from sc where sc.cno= 'c2';
posted @ 2014-04-04 18:01  sunshine_qqq  阅读(10796)  评论(0编辑  收藏  举报