level 3
select s.sname,t.* from student s,
(select t1.sid,t1.cname,t1.score,t2.score from(
(select sc.sid,sc.cid,c.cname,sc.score from sc inner join course c on c.cid=sc.cid where sc.cid=3) t1,
(select sc.sid,sc.cid,c.cname,sc.score from sc inner join course c on c.cid=sc.cid where sc.cid=4) t2
where t1.sid=t2.sid) t
where s.sname=t.tid
2019年10月18日 05点10分
3
最后一个是sid写错了。
2019年10月18日 05点10分
好的,我明天试试,还是不行再继续问
2019年10月19日 16点10分
你这个有点看不懂啊,我还没学inner join,还有其它的办法吗?
2019年10月22日 08点10分
试试这个 SELECT * FROM student s,Course c, cs WHERE s.sru = cs.sru AND c.cro=cs.cro AND cs.cro IN(3,4) HAVING COUNT(cs.sur)>1
2019年10月22日 09点10分
level 3
就是先把1课程的学生id求出,2课程学生id求出,关联相等,就是都有的,然后再关联得到其他的信息
2019年10月18日 05点10分
4
level 1
select sname,cname,grade from student s,course c,sc
where s.sno = sc.sno and c.cno =sc.con and sc.con in (3,4) and
s.sno in
(select sno from sc where con in (3,4) group by sno having count(sno)>1)
2019年10月22日 14点10分
7
对就是这样,仿照你的做出来了,谢啦
2019年10月22日 15点10分