Sql每个班级课程平均成绩
1. 一张学生成绩表内SQL查询每个班级每门课程的平均分
select avg(分数) as 平均分, rtrim(cast(sum(case when 分数>=60 then 1 end)/count(*)*100 as char(10)))+'%' as 及格率 from A group by 班级,课程
2. sql题 查询每位同学的课程门数、总成绩、平均成绩”的SQL语句是什么
selectavg(成绩字段)平均成绩,sum(成绩字段)总成绩,count(课程字段)课程门数from表groupby学生字段;
3. 如何用SQL语句查询各门课程的平均成绩
创建表:
SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[stuscore]
( [name] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
[subject] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
[score] [int] NULL,
[stuid] [int] NULL)
ON [PRIMARY]
GO
SET ANSI_PADDING OFF
插入数据:
insert into dbo.stuscore values ('张三','数学',89,1);
insert into dbo.stuscore values ('张三','语文',80,1);
insert into dbo.stuscore values ('张三','英语',70,1);
insert into dbo.stuscore values ('李四','数学',90,2);
insert into dbo.stuscore values ('李四','语文',70,2);
insert into dbo.stuscore values ('李四','英语',80,2);
查询结果如下:
列出各门课程的平均成绩:
select subject,AVG(score)平均成绩 from stuscore
group by subject;
4. SQL查询语句,要得到每个班每门课程的平均分,以及每个班的人数。如图:
select 班级,avage(语文) as 语文,avage(数学) as 数学,count(*) as 人数 from table groub by 班级
5. sql 查询每个班级每门课程选课人数和平均分
select class,cname,count(sno) as '选课人数',avg(grade) as '平均版分权'
from student a join sc b on a.sno=b.sno join course c on b.cno=c.cno
group by class,cname
6. 查询每位同学的课程门数、总成绩、平均成绩”的SQL语句是什么
SQL语句如下:
SELECT 学号, Count(课程编号) AS 课程总数, Sum(成绩) AS 总分数, Avg(成绩) AS 平均分
FROM 成绩表
GROUP BY 学号;
SQL常用操作语句如下:
选择:select * from table1 where 范围
插入:insert into table1(field1,field2) values(value1,value2)
删除:delete from table1 where 范围
更新:update table1 set field1=value1 where 范围
查找:select * from table1 where field1 like ’%value1%’
排序:select * from table1 order by field1,field2 [desc]
总数:select count as totalcount from table1
求和:select sum(field1) as sumvalue from table1
平均:select avg(field1) as avgvalue from table1
最大:select max(field1) as maxvalue from table1
最小:select min(field1) as minvalue from table1
7. 用SQL查询,某门课程每个班的总平均分(从高到低排列)
SELECT
AVG(数学)from
分数表
group
by
班级
order
by
AVG(数学)DESC
希望是满意答案,急需!!!!!!!!谢谢
8. SQL求每个学生平均成绩
select student.学号,student.姓名, course.课程名,(select avg(sc.成绩版) from sc where sc.学号权=student.学号) as 平均成绩 from student inner join sc on student.学号=sc.学号 inner join course on sc.课程号=course.课程号
9. SQL问题:如何分别给每个班算平均分
select 班级,avg(table.科目1) as 别名 ,avg(table.科目2) as 别名2,...,
from 表名
group by 班级
SQL查询语句,要得到每个班每门课程的平均分,专以及每属个班的人数
select 班级,avage(table.科目) as 别名,avage(科目2) as 别名2,count(*) as 人数 from table groub by 班级