针对表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
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
举一反三
- 表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
- 关系SC(Sno,Cno,Grade)表示学号,课程号,成绩。现要查询最高分在91分以上的学生的学号和平均成绩,正确的语句是______。 A: SELECT Sno,MAX(Grade) FROM SC WHERE MAX(Grade)>=91 GROUP BY Sno B: SELECT Sno,MAX(Grade) FROM SC GROUP RY Sno HAVING MAX(Grade)>=91 C: SELECT Sno,MAX(Grade) FROM SC WHERE MAX(Grade)>=91 ORDER BY Sno D: SELECT Sno,MAX(Grade) FROM SC GROUP BY Cno HAVING MAX(Grade)>=91
- 关系SC(Sno,Cno,Grade)表示学号、课程号、成绩。现要查询最高分在91分以上的学生的学号和平均成绩,正确的语句是______。 A: SELECT Sno,MAX(Grade)<br> FROM SC<br> WHERE MAX(Grade)≥91<br> GROUP BY Sno B: SELECT Sno,MAX(Grade)<br> FROM SC<br> GROUP BY Sno<br> HAVING MAX(Grade)≥91 C: SELECT Sno,MAX(Grade)<br> FROM SC<br> WHERE MAX(Grade)≥91<br> ORDER BY Sno D: SELECT Sno,MAX(Grade)<br> FROM SC<br> GROUP BY Cno<br> HAVING MAX(Grade)≥91
- 查询最低成绩大于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;