A: CREAT VIEW S_G(Sno,Gavg) AS SELECT Sno,AVG(Grade) FROM SCGROUP BY Sno;
B: CREAT VIEW S_G(Sno,AVG(Grade)) AS SELECT Sno,AVG(Grade) FROM SCGROUP BY Sno;
C: CREAT VIEW S_G AS SELECT Sno,AVG(Grade) FROM SCGROUP BY Sno;
D: CREAT VIEW S_G(Sno,Gavg) AS SELECT Sno,AVG(Grade) FROM SCORDER BY 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;
- 表sc中存放了多个学生的多门课程的成绩,sno为学号,cno为课程号,grade为成绩。要查询平均分最高的学生学号和平均分,下列()语句可以实现。 A: SELECT top 1 sno,avg(grade) FROM sc group by sno order by avg(grade) desc B: SELECT sno,max(avg(grade)) FROM sc group by sno C: SELECT sno,max(grade), avg(grade) FROM sc group by sno D: SELECT sno,max(grade) FROM sc group by sno
- 查询最低成绩大于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;
- 在学生选课数据库中,查询平均成绩大于等于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;
- 查询平均成绩小于70分的学生学号和平均成绩 A: SELECT Sno, AVG(grade) FROM SC GROUPBYSno B: SELECT Sno, AVG(grade) FROM SC GROUPBYSno HAVINGAVG(grade)<70; C: SELECT Sno, grade FROM SC GROUPBYSno HAVINGAVG(grade)<70;
内容
- 0
针对表SC(sno, cno, grade),其中sno为学号,cno为课程号,grade为成绩。以下哪个操作( )统计出每位学生所选课程的最高分和最低分。 A: select sno,max(grade), min(grade) from sc B: select sno,max(grade), min(grade) from sc order by sno C: select sno,max(grade), min(grade) from sc group by sno D: select sno,avg(grade), sum(grade) from sc group by sno
- 1
关系SC(Sno,Cno,Grade)表示学号,课程号,成绩。现要查询平均分在90分以上的学生的学号和平均成绩,正确的语句是______。 A: SELECT Sno,AVG(Grad FROM SC WHERE AVG(Grad>=90 GROUP BY Sno B: SELECT Sno,AVG(Grad FROM SC GROUP BY Sno HAVING AVG(Grad>=90 C: SELECT Sno,AVG(Grad FROM SC WHERE AVG(Grad>=90 ORDER BY Sno D: SELECT Sno,AVG(Grad FROM SC GROUP BY Cno HAVING AVG(Grad>=90
- 2
下列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)
- 3
下列SQL语句中,_____________可以在“学生-课程”数据库正确实现“查询选修并成绩良好3门以上课程的学生学号及其满足条件的课程门数”。 A: SELECT Sno,COUNT(*)FROM SCGROUP BY SnoHAVING Grade>=80 AND COUNT(*) >3 B: SELECT Sno,COUNT(*)FROM SCWHERE Grade>=80GROUP BY SnoHAVING COUNT(*) >3 C: SELECT Sno,COUNT(*)FROM SCGROUP BY SnoWHERE Grade>=80HAVING COUNT(*) >3 D: SELECT Sno,COUNT(*)FROM SCGROUP BY SnoWHERE Grade>=80 AND HAVING COUNT(*) >3
- 4
已知关系模式:SC(sno,sname,grade),各属性含义依次为学号、课程名、分数。要查找“数据库”课分数最高的学生的学号,正确的SQL语句是( )。 A: SELECT sno FROM sc WHERE sname="数据库"AND grade=MAX(grade) B: SELECT sno FROM sc FOR sname="数据库"OR grade>=MAX(grade) C: SELECT sno FROM sc WHERE sname="数据库"AND grade=(SELECT MAX(grade)FROM sc) D: SELECT sno FROM sc FOR sname="数据库"OR grade=(SELECT MAX(grade)FROM s