如下⼏个表所示学⽣、课程、必修课和选课关系,⽤SQL语⾔实现下列操作。列出各⻔课的平均成绩、最⾼成绩、最低成绩和选课⼈数。正确的SQL语句是( )。
A: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 GROUP BY 课号;
B: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 ORDER BY 课号;
C: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 WHERE 课号;
D: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 HAVING 课号;
A: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 GROUP BY 课号;
B: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 ORDER BY 课号;
C: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 WHERE 课号;
D: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 HAVING 课号;
举一反三
- 【单选题】如表 10.3 、表 10.4 、表 10.5 和表 10.6 所示,用 SQL 语言实现下列操作。 列出各门课的平均成绩、最高成绩、最低成绩和选课人数。正确的 SQL 语句是 _____ 。 A. SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 ORDER BY 课号 B. SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 WHERE 课号 C. SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 HAVING 课号 D. SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课 GROUP BY 课号
- 如下几个表所示学生、课程、必修课和选课关系,用SQL语言实现下列操作。列出各门课的平均成绩、最高成绩、最低成绩和选课人数。正确的SQL语句是_____[img=520x271]18034691f7335c4.png[/img] A: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课HAVING 课号; B: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号)FROM 选课GROUP BY 课号; C: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课WHERE 课号; D: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号) FROM 选课ORDER BY 课号;
- 如表10.3、表10.4、表10.5和表10.6所示,用SQL语言实现下列操作。 [img=520x266]180310c45e3b928.png[/img]列出各门课的平均成绩、最高成绩、最低成绩和选课人数。正确的SQL语句是_____ 。 A: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号)FROM 选课GROUP BY 课号 B: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号)FROM 选课ORDER BY 课号 C: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号)FROM 选课WHERE 课号 D: SELECT 课号,AVG(成绩),MAX(成绩),MIN(成绩),COUNT(学号)FROM 选课HAVING 课号
- 已知选课表结构如下:(学号,课程号,成绩),现要查询C1课程的考试成绩最高分与平均分,则下列查询语句正确的是() A: select max(成绩) as 最高分. avg(成绩) as 平均分 from 选课 where 课程号=C1 B: select max(成绩) set 最高分. avg(成绩) set 平均分 from 选课 where 课程号=C1 C: select max(成绩) rename最高分. avg(成绩) rename 平均分 from 选课 where 课程号=C1 D: select max(成绩). avg(成绩) from 选课 where 课程号=C1 E: select max(成绩). min(成绩) from 选课 where 课程号=C1
- 第4单元,设有学生表student(学号,姓名,系名,课程号,成绩),查询至少选修了4门课程的学生学号及平均成绩的正确语句是() A: SELECT 学号, AVG(成绩) AS 平均成绩 FROM student GROUP BY 学号 HAVING COUNT(课程号)>3; B: SELECT 学号, AVG(成绩) AS 平均成绩 FROM student GROUP BY 课程号 HAVING COUNT(课程号)>3; C: SELECT 学号, AVG(成绩) AS 平均成绩 FROM student GROUP BY 学号 HAVING COUNT(课程号)>4; D: SELECT 学号, AVG(成绩) AS 平均成绩 FROM student GROUP BY 课程号 HAVING COUNT(DISTINCT 学号)>3;