在MySQL中,可以使用聚合函數和GROUP BY子句對成績(score)進行統計分析。以下是一些常見的統計分析方法:
SELECT AVG(score) as average_score FROM your_table;
SELECT MIN(score) as min_score, MAX(score) as max_score FROM your_table;
SELECT SUM(score) as total_score FROM your_table;
SELECT
CASE
WHEN score BETWEEN 0 AND 59 THEN '0-59'
WHEN score BETWEEN 60 AND 79 THEN '60-79'
WHEN score BETWEEN 80 AND 99 THEN '80-99'
ELSE '100'
END as score_range,
COUNT(*) as count
FROM your_table
GROUP BY score_range;
SELECT class, AVG(score) as average_score, MIN(score) as min_score, MAX(score) as max_score
FROM your_table
GROUP BY class;
請將your_table
替換為你的表名,并根據需要調整查詢語句。