用SQL语句查询各选修课程的最高分、最低分、平均分和选课人数。

2024-12-26 18:26:32
推荐回答(2个)
回答1:

SELECT CNAME,CTEACHER, 最高分, 最低分,平均分, 选课人数
FROM
( SELECT MAX(SCGRADE) AS 最高分,
MIN(SCGRADE) AS 最低分,
AVG(SCGRADE) AS 平均分,
COUNT(SNO) AS 选课人数
ROM C
ROUP BY CNO
) AS z

回答2:

SELECT
MAX(SCGRADE) AS 最高分,
MIN(SCGRADE) AS 最低分,
AVG(SCGRADE) AS 平均分,
COUNT(SNO) AS 选课人数
FROM C
GROUP BY CNO
难道我理解错了,不是这么简单吧!