SQL 练习22
- 查询出只选修两门课程的学生学号和姓名
--方式1:
SELECT Student.SId,Sname from Student WHERE SId in (
SELECT sid from sc GROUP BY SId HAVING COUNT(cid)=2 )
--方式2
SELECT Student.SId,Sname from Student,
(SELECT sid from sc GROUP BY SId HAVING COUNT(cid)=2) as t WHERE Student.sid = t.sid
本文来自博客园,作者:弩哥++,转载请注明原文链接:https://www.cnblogs.com/bangbangzoutianya/p/15166654.html