设关系模式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
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) 。 (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
- 设关系模式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
- 关系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
- 按照学号进行分组,统计学生的平均成绩,且平均分按降序排列 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)
- 设有关系模式xkb(学号,课程号,成绩),今要查询每门课程的平均成绩,且要求查询的结果按平均成绩降序排列,平均成绩相同的,按课程号升序排列,则下列正确的查询语句是( )。 A: select 课程号 ,avg(成绩) 平均成绩from xkbgroup by 课程号order by 2 desc,1 B: select 课程号 cno ,avg(成绩) avg_gradefrom xkbgroup by 课程号order by avg_grade desc, cno C: select 课程号 cno ,avg(成绩) avg_gradefrom xkbgroup by cnoorder by avg_grade desc, cno D: select 课程号 ,avg(成绩) 平均成绩from xkbgroup by 课程号order by 平均成绩 desc, 课程号