基于教材上的学生表Student、课程表Course和选课表SC,查找所有比学生“王华”年龄大的学生姓名、年龄和性别,正确的SQL语句是________。
A. SELECTSname, Sage, Ssex FROMStudentWHERE Sage > ( SELECT Sage FROM Student WHERESname = '王华' )
B. SELECTSname, Sage,Ssex FROM Student WHERESname = '王华'
C. SELECTSname, Sage,Ssex FROMStudentWHERE Sage > ( SELECT Sage WHERESname = '王华' )
D. SELECTSname, Sage,SsexFROM StudentWHERE Sage > '王华'.Sage
查看答案
基于教材上的选课表SC,使用嵌套查询查找所有超过所选课程平均分的学生选课记录,正确的SQL语句是________。
A. SELECTSno, Cno, Grade FROMSC SC1WHERE Grade>(SELECT AVG(Grade) FROMSC SC2);
B. SELECTSno, Cno, Grade FROMSC SC1WHERE Grade>(SELECT AVG(Grade) FROMSC SC2 WHERE SC2.Cno=SC1.Cno);
C. SELECTSno, Cno, Grade FROMSC SC1WHERE Grade>(SELECT AVG(Grade) FROMSC SC2 GROUP BY SC2.Cno);
D. SELECTSno, Cno, Grade FROMSC SC1WHERE AVG(Grade)>(SELECT Grade FROMSC SC2 WHERE SC2.Cno=SC1.Cno);
现有学生关系表S(sno,sname,ssex,sage),查找年龄比某个女生小的男生信息,对应的SQL语句是________。
A. select * fromSwhere ssex='男' and sage in(select sage from S where ssex='女');
B. select * fromSwhere ssex='男' and sage<(select sage from S where ssex='女');
C. select * fromSwhere ssex='男' and sage D. select * fromSwhere ssex='男' and sage
现有学生关系表S(sno,sname,ssex,sage)和选修关系表SC(sno, cname, grade),查找没有选修"数据库"课程的学生个人信息,对应的SQL语句是________。
A. select*fromS where exists(select * from SC where SC.sno=S.sno and SC.cname<>'数据库 );
B. select*fromS where exists(select * from SC where SC.sno<>S.sno and SC.cname='数据库 );
C. select*fromS where not exists(select * from SC where SC.sno=S.sno and SC.cname<>'数据库 );
D. select*fromS where not exists(select * from SC where SC.sno=S.sno and SC.cname='数据库 );
现有学生关系表S(sno,sname,ssex,sage),查找比所有"张三"年龄大的男生信息,下列选项中正确的SQL语句是________。
A. select * fromSwhere ssex='男' and sage>SOME(select sage from S where sname='张三);
B. select * fromSwhere ssex='男' and sage>ALL(select sage from S where sname='张三);
C. select * fromSwhere ssex='男' and sage>(select max(sage) from S where sname='张三);
D. select * fromSwhere ssex='男' and sage>(select min(sage) from S where sname='张三);