考试报名
考试报名
考试内容
考试大纲
在线客服
返回顶部

备考刷题,请到

CDA认证小程序

假设有scores表的设计如下:StudentID(学生编号),Class(班级),CourseID(课程编号),Score(分数) (1)查询参加过至少两门课程考试的学生各门课程的平均成绩,以下SQL语句正确的是
A. select StudentID,avg(score) from scores group by StudentID having count(studentID)>=2
B. select StudentID,avg(score) from scores group by StudentID where count(studentID)>=2
C. select StudentID,avg(score) from scores where count(studentID)>=2 group by StudentID
D. select StudentID,avg(score) from scores having count(studentID)>=2 group by StudentID
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(1)

用户70480
1. 看条件要不要聚合(如“至少两门”、“大于平均值”)→ 必须用 HAVING,排除 WHERE 中带聚合函数的选项(C直接排除)。 2. 看语序:GROUP BY 必须在 HAVING 前面(排除D)。 3. 看整体顺序:WHERE(行过滤)→ GROUP BY(分组)→ H