当前位置:首页 » 编程语言 » sql按性别统计成绩
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

sql按性别统计成绩

发布时间: 2022-07-06 14:47:23

sql怎么求男女学生平均成绩

select a.性别,AVG(B.成绩) as 平均成绩 from 人员信息表 a join 学生成绩表 b on a.id=b.id
大概是这么样的写法,你看看你的人员信息表和成绩表关联条件是什么样的,

数据库中用SQL语言分别求男女的平均成绩,要求包含成绩和性别字段,在线等!

应该是这样吧:
select 性别,avg(英语) as 平均成绩 form zgk group by 性别;

Ⅲ 编写Sql,查询学生表中分数大于等于60的学生信息并按照性别分组自以及分数降序

摘要 前面1~5都比较简单,我就单说问题6:

Ⅳ 用sql语言按性别统计出语文和数学至少一门不及格的学生人数

select 性别,count(*) 人数 from table where 语文<60 or 数学<60
group by 性别

Ⅳ mysql如何用一条sql查询一个班6个人,男生成绩总数和女生成绩总数。

select(SELECTSUM(成绩)FROM`student`wheresex='男')asa,(SELECTsum(成绩)fromstudentWHEREsex='女')asb;

Ⅵ sql语句,表连接。用sql语句按男女分类统计各科的总成绩和平均成绩

建议你先创建个视图。 create view xs_cj as ( select xs.xm,xs.xb,xs.rxsj,cj.xyw,cj.sx,cj.yy from xs inner join cj on xs.xm=cj.xm ); 然后查询: select xb, sum(yw) 'sum(yw)',sum(sx)'sum(sx)',sum(yy) 'sum(yy)', avg(yw) 'avg(yw)',avg(sx)'avg(sx)',avg(yy) 'avg(yy)' from xs_cj group by xb ;

Ⅶ SQL语句怎么分别统计男女数学英语成绩平均分

selectavg(数学成绩),avg(英语成绩)fromstudentgroupby性别

Ⅷ 写出Tansact-SQL语句,按性别统计表stu_info中的人数及平均成绩

select
性别,count(*)
as
人数,avg(成绩)
as
平均成绩
from
sut_info
group
by
性别
性别,成绩那俩字段,你替换成你表里相应的名称就好

Ⅸ sql 语言 统计不同性别学生的人数,入学成绩最高,最低,平均分

sql 查询最高分、最低分和平均分语句
//我们要用就以学生成绩为实例吧
/*
结构
学生表
Student(S#,Sname,Sage,Ssex) --S# 学生编号,Sname 学生姓名,Sage 出生年月,Ssex 学生性别
--2.课程表
Course(C#,Cname,T#) --C# --课程编号,Cname 课程名称,T# 教师编号

*/
查询各科成绩最高分、最低分和平均分:以如下形式显示:课程ID,课程name,最高分,最低分,平均分,及格率,中等率,优良率,优秀率
--及格为>=60,中等为:70-80,优良为:80-90,优秀为:>=90
--方法1
select m.C# [课程编号], m.Cname [课程名称],
max(n.score) [最高分],
min(n.score) [最低分],
cast(avg(n.score) as decimal(18,2)) [平均分],
cast((select count(1) from SC where C# = m.C# and score >= 60)*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [及格率(%)],
cast((select count(1) from SC where C# = m.C# and score >= 70 and score < 80 )*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [中等率(%)],
cast((select count(1) from SC where C# = m.C# and score >= 80 and score < 90 )*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [优良率(%)],
cast((select count(1) from SC where C# = m.C# and score >= 90)*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [优秀率(%)]
from Course m , SC n
where m.C# = n.C#
group by m.C# , m.Cname
order by m.C#
--方法2
select m.C# [课程编号], m.Cname [课程名称],
(select max(score) from SC where C# = m.C#) [最高分],
(select min(score) from SC where C# = m.C#) [最低分],
(select cast(avg(score) as decimal(18,2)) from SC where C# = m.C#) [平均分],
cast((select count(1) from SC where C# = m.C# and score >= 60)*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [及格率(%)],
cast((select count(1) from SC where C# = m.C# and score >= 70 and score < 80 )*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [中等率(%)],
cast((select count(1) from SC where C# = m.C# and score >= 80 and score < 90 )*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [优良率(%)],
cast((select count(1) from SC where C# = m.C# and score >= 90)*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [优秀率(%)]
from Course m
order by m.C#

Ⅹ 查询学生档案中的学生总数入学成绩的平均值,按性别分类怎么写sql查询语句

你好,很高兴回答你的问题。
类似这样的问题,不同的表结构对应的查询语句是不同的,所以先提供一下表结构吧,大家才好依据表结构帮你解决问题。