查询至少选修了两门课程的学生学号的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';


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM