3 table S(student), C(course), SC(StudentCourse):
s(sno,sname)
c(cno,cname,cteacher)
sc(sno, cno, scgrade)
Q:
A:
1,
1 select sname from s join sc on(s.sno = sc.sno) join c on(sc.cno = c.cno) 2 where cteacher <> ‘liming‘
2.1,
1 select sname from s where sno in 2 ( 3 select sno from sc where scgrade < 60 group by sno having count(*) >= 2 4 )
2.2,
1 select avg(scgrade) from sc join s on(sc.sno = s.sno) 2 where sname in 3 ( 4 select sname from s where sno in 5 ( 6 select sno from sc where scgrade < 60 group by sno having count(*) >= 2 7 ) 8 ) group by sname
3,
1 select sname from s join sc on(s.sno = sc.sno) 2 where sno in 3 ( 4 select sno from sc where cno = 1 and sno in 5 (select sno from sc where cno = 2) 6 )
ref: oracle
原文:http://www.cnblogs.com/listened/p/3708051.html