下列SQL语句中,_____________可以在“学生-课程”数据库正确实现“找出每个学生超过他选修课程平均成绩的课程号”。
A: SELECT Sno,CnoFROM SC xWHERE Grade >=(SELECT AVG(Grade) FROM SC y WHERE y.Sno=x.Sno)
B: SELECT Sno,CnoFROM SC xWHERE (SELECT AVG(Grade) FROM SC y WHERE y.Sno=x.Sno)<=Grade
C: SELECT Sno,CnoFROM SC WHERE Grade >=(SELECT AVG(Grade) FROM SC )
D: SELECT x.Sno,x.CnoFROM SC x, SC yWHERE y.Sno=x.Sno AND x.Grade >=(SELECT AVG(Grade) FROM y)
A: SELECT Sno,CnoFROM SC xWHERE Grade >=(SELECT AVG(Grade) FROM SC y WHERE y.Sno=x.Sno)
B: SELECT Sno,CnoFROM SC xWHERE (SELECT AVG(Grade) FROM SC y WHERE y.Sno=x.Sno)<=Grade
C: SELECT Sno,CnoFROM SC WHERE Grade >=(SELECT AVG(Grade) FROM SC )
D: SELECT x.Sno,x.CnoFROM SC x, SC yWHERE y.Sno=x.Sno AND x.Grade >=(SELECT AVG(Grade) FROM y)
举一反三
- 以下命令是相关子查询的嵌套查询是: A: SELECT * FROM student WHERE sno IN (SELECT sno FROM sc WHERE cno = '1') B: SELECT * FROM student WHERE EXISTS (SELECT * FROM sc WHERE cno = '1' AND sc.sno = student.sno) C: SELECT sno, cno FROM sc x WHERE grade>(SELECT AVG(grade) FROM sc y WHERE y.sno = x.sno) D: 以上都是
- 在学生选课数据库中,查询平均成绩大于等于60分的同学,SQL语句为( ) A: SELECT Sno, AVG(Grade) FROM SC GROUP BY Sno HAVING AVG(Grade)>=60; B: SELECT Sno FROM SC WHERE Grade>=60 GROUP BY Sno; C: SELECT Sno, Grade FROM SC GROUP BY Sno HAVING AVG(Grade)>=60; D: SELECT Sno FROM SC GROUP BY Sno HAVING Grade >=60;
- 有学生选课表SC(Sno,Cno,Grade),各属性分别为学号、课程号和成绩;完成下列SQL语句:找出每个学生超过他选修课平均成绩的课程号。 SELECT Sno,Cno FROM SC X WHERE() (SELECT() FROM SC Y WHERE Y.Sno=X.Sno)
- 在学生选课数据库中,查询平均成绩大于等于60分的同学,SQL语句为( ) A: SELECT Sno, AVG(Grade) FROM SC GROUP BY Sno HAVING AVG(Grade)>=60; B: SELECT Sno FROM SC WHERE Grade>=60 GROUP BY Sno; C: SELECT Sno, Grade FROM SC GROUP BY Sno HAVING AVG(Grade)>=60; D: SELECT Sno FROM SC GROUP BY Sno HAVING Grade >=60;
- 查询最低成绩大于85分的学生学号和平均成绩,可以使用的查询语句是: 。 A: SELECT Sno, AVG(Grade) FROM SC HAVING MIN(Grade) > 85 GROUP BY Sno; B: SELECT Sno, AVG(Grade) FROM SC GROUP BY Sno HAVING MIN(Grade) > 85; C: SELECT Sno, AVG(Grade) FROM SC WHERE MIN(Grade) > 85 GROUP BY Sno; D: SELECT Sno, AVG(Grade) FROM SC GROUP BY Sno WHERE MIN(Grade) > 85;