SQL 数据库 马上考试了谢谢大家

设某学生数据库中有一个“学生成绩”表,该表包含的列有:学号、姓名、数学成绩、英语成绩。其中,数学成绩和英语成绩列为smallint类型,使用聚合函数实现以下各功能。(1)求所有学生的数学平均成绩和英语平均成绩。(2)统计数学成绩大于80分的学生人数。(3)统计学生总人数(4)求最高数学成绩,最低数学成绩(5)求所有学生的数学总成绩和英语总成绩。
最新回答
__宫雅沫つ

2024-05-06 04:37:45

1)求所有学生的数学平均成绩和英语平均成绩
select avg(数学成绩) as 数学平均成绩,avg(英语成绩) as 英语平均成绩 from 学生成绩
 
2)统计数学成绩大于80分的学生人数
select count(*) as 人数 from 学生成绩 where 数学成绩>80
 
3)统计学生总人数
select count(*) as 人数 from 学生成绩
 
4)求最高数学成绩,最低数学成绩
select max(数学成绩) as 最高数学成绩,min(数学成绩) as 最低数学成绩 from 学生成绩
 
5)求所有学生的数学总成绩和英语总成绩
select sum(数学成绩) as 数学总成绩,sum(英语成绩) as 英语总成绩 from 学生成绩
脸滚键盘抬头懵

2024-05-06 03:17:29

1、select avg(数学成绩) as 数学平均, avg(英语成绩) as 英语平均 from 学生成绩 
2、select count(1) as renshu from 学生成绩 where 数学成绩>80
3、select count(1) as zongrenshu  from 学生成绩
4、select max(数学成绩) as 最高数学, min(数学成绩) as 最低数学 from 学生成绩
5、select sum(数学成绩) as 数学总分, sum(英语成绩) as 英语总分 from 学生成绩
它的糖诗

2024-05-06 13:33:46

假设学号为id,姓名为name,数学成绩为math,英语成绩为english
(1)select t.name,avg(t.math) ,avg(t.english) from student t
(2)select sum(t.id) from student t where t.math >80
(3)select sum(t.id) from student t
(4)select t.name,max(t.math) from student t;
select t.name,min(t.math) from student t;
(5)select t.name, sum(t.math), sum(t.english) from student t