问题详情

检索选修四门以上课程的学生总成绩(不统计不及格的课程),并要求按总成绩降序排列出来,正确的SELECT语句是______。


A、SELECT S#,SUM(GRADE)FROM SC WHERE GRADE>=60 CROUP BY S# ORDER BY 2 DESC HAVING COUNT(*)>=4

B、SELECT S#,SUM(GRADE)FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY 2 DESC

C、SELECT S#,SUM(GRADE)FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROUP BY S# ORDER BY 2 DESC

D、DELECT S#,SUM(GRADE)FROM SC WHERE GRADE>=60 ORDER BY 2 DESC CROUP BY S# HAVING COUNT(*)>=4

时间:2022-01-07 22:56 关键词:

答案解析

B
解析:本题的要求是检索选修四门以上课程的学生总成绩(不统计不及格的课程),并要求按总成绩的降序排列出来。所需要的表只有SC表,并且需要求总成绩,这就应该用到Sum子句,还需要按照总成绩的降序排列,因此还需要利用ORDER BY子句,同时要将同一个学生的选修记录排列在一起,因此根据以上分析选项B的SQL语句满足要求。
相关问题