设关系模式SCG (S#, C#, grade)中S#为学生学号,C#为课程号,grade为某学号学生学某号课程的考试成绩。今要查询每门课程的平均成绩,且要求查询的结果按平均成绩升序排列,平均成绩相同时,按课程号降序排列,则用SQL查询语言应为 (1) 。 若查询的结果仅限于平均分数超过80分的,则应 (2) 。 (1)
A: Select C#,AVG(grade) From SCG Group by grade Order by 2,C# Desc
B: Select C#,AVG(grade) From SCG Group by C# Order by 2,C# Desc
C: Select C#,AVG(grade) From SCG Where C#,AVG Desc Group by grade
D: Select C#,AVG(grade) From SCG Group by AVG(grade) Order by 2,C# Desc
A: Select C#,AVG(grade) From SCG Group by grade Order by 2,C# Desc
B: Select C#,AVG(grade) From SCG Group by C# Order by 2,C# Desc
C: Select C#,AVG(grade) From SCG Where C#,AVG Desc Group by grade
D: Select C#,AVG(grade) From SCG Group by AVG(grade) Order by 2,C# Desc
举一反三
- 设关系模式SCG (S#, C#, grade)中S#为学生学号,C#为课程号,grade为某学号学生学某号课程的考试成绩。今要查询每门课程的平均成绩,且要求查询的结果按平均成绩升序排列,平均成绩相同时,按课程号降序排列,则用SQL查询语言应为 (1) 。 若查询的结果仅限于平均分数超过80分的,则应 (2) 。 (1) A: Select C#,AVG(grad From SCG Group by grade Order by 2,C# Desc B: Select C#,AVG(grad From SCG Group by C# Order by 2,C# Desc C: Select C#,AVG(grad From SCG Where C#,AVG Desc Group by grade D: Select C#,AVG(grad From SCG Group by AVG(grad Order by 2,C# Desc
- 设关系模式SCG (S#, C#, grade)中S#为学生学号,C#为课程号,grade为某学号学生学某号课程的考试成绩。今要查询每门课程的平均成绩,且要求查询的结果按平均成绩升序排列,平均成绩相同时,按课程号降序排列,则用SQL查询语言应为 (1) 。 若查询的结果仅限于平均分数超过80分的,则应 (2) 。 (2) A: 在Group子名的下一行加入: Having Avg(*)>80 B: 在Group子名的下一行加入: Having AVG(grade)>80 C: 在Group子名的下一行加入: Where AVG(grade)>80 D: 在Group子名的下一行加入: Where AVG(*)>80
- 按照学号进行分组,统计学生的平均成绩,且平均分按降序排列 A: select sid, avg(grade) from sc group by sid order by avg(grade) desc B: select sid, avg(grade) from sc group by cid order by avg(grade) desc C: select sid, avg(grade) from student group by sid order by avg(grade) desc D: select sid, avg(grade) from student group by cid order by avg(grade)
- 有学生表S(S#,SN,SEX,AGE,DEPT),课程表C(C#,CN),学生选课表SC(S#,C#,GRADE),检索选修课程"C2"的学生中成绩最高的学生的学号,正确的SELECT语句是_________。 A: SELECT S# FROM SCWHERE C#="C2" AND GRADE>=(SELECT GRADE FROM SC WHERE C#="C2") B: SELECT S# FROM SCWHERE C#="C2" AND GRADE IN(SELECT GRADE FROM SC WHERE C#="C2") C: SELECT S# FROM SCWHERE C#="C2" AND GRADE NOT IN(SELECT GRADE FROM SC WHERE C#="C2") D: SELECT S# FROM SCWHERE C#="C2" AND GRADE>=ALL
- 表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