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

上一篇 / 下一篇  2014-04-04 10:06:01 / 个人分类:sql server

第一个:至少选修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';

TAG:

 

评分:0

我来说两句

我的栏目

日历

« 2024-04-26  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 9554
  • 日志数: 11
  • 建立时间: 2012-08-21
  • 更新时间: 2014-05-20

RSS订阅

Open Toolbar