一个sql题,难了老半天
学生表 A1(sid,sname) 课程表A2(cid,cno) 成绩表A3(scid,sid,cid,defen)
查询 课程标号cno2的成绩大于课程标号cno1的成绩的学生名
[解决办法]
- SQL code
select t5.snamefrom a3 t1,a3 t2,a2 t3,a2 t4,a1 t5where t1.sid=t2.sid and t1.cid=t3.cid and t2.cid=t4.cid and t1.sid=t5.sidwhere t3.cno='cno1' and t4.cno='cno2' and t1.defen>t2.defen