用SQL语句查询至少选修了学生‘张征’选修的全部课程的学生的姓名和学号,表格如图,结果求图,要验证
用SQL语句查询至少选修了学生‘张征’选修的全部课程的学生的姓名和学号,表格如图,结果求图,要验证了的那种,谢谢大神!!...
用SQL语句查询至少选修了学生‘张征’选修的全部课程的学生的姓名和学号,表格如图,结果求图,要验证了的那种,谢谢大神!!
展开
3个回答
2016-05-18
展开全部
select S.Sno,S.Sname from
(
select Sno, COUNT(Cno) as num from SC where Cno in (
select Cno from S join SC on S.Sno = SC.Sno and Sname ='张征'
)
group by Sno
) t2
join(select COUNT(Cno) num from S join SC on S.Sno = SC.Sno and Sname ='张征' ) t1 on t2.num = t1.num
join S on S.Sno = t2.Sno
已验证过
追问
完全对的!谢谢了!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询