当前位置:首页 » 编程语言 » sql合格率
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

sql合格率

发布时间: 2023-01-24 14:48:29

① 一条sql语句查询出三年级所有老师所带学生的及格率 :老师名称 老师所带学生数目 及格学生数目

select C_TEACH_NAME,(select count(*) as count0 from c,e,f where c.C_TEACH_CODE=e. C_TEACH_CODE and e.C_CLASS_CODE=f.C_CLASS_CODE group by C_TEACH_NAME),(select count(*) as count1,round(count1/count0,2) from c,e,f,g where c.C_TEACH_CODE=e. C_TEACH_CODE and e.C_CLASS_CODE=f.C_CLASS_CODE and f.C_STUDENT_CODE=g.C_STUDENT_CODE and N_STUDENT_SCORE>=60 group by C_TEACH_NAME) from c group by C_TEACH_NAME;

② sql合格率的问题

select max(成绩),min(成绩),avg(成绩),
(select cast(ceiling(人数*1.0/总人数*100) as varchar(3))+ '% '
from (select count(id) 人数
from table s,(select avg(成绩) as 平均分 from table) b
where s.成绩>=平均分) e,(select count(id) 总人数 from table) c)from table

③ sql select语句求及格率(带百分号)

select cast( cast ( ( select count(1) as jige from 表 where 课程名称 = 'C语言' and 分数 >= 60 ) as numeric(10,4) ) / cast ( ( select count(1) as jige from 表 where 课程名称 = 'C语言' ) as numeric(10,4) ) * 100 as varchar(20) ) + '%'

④ sql中创建存储过程,该存储过程计算及格率和优秀率(平均分超80分)

select convert(varchar(10),sum(case when (html+sql)/2>=60 and (html+sql)/2<80 then 1 else 0 end)*100.0/
stucount)+'%' as 及格率,
convert(varchar(10),sum(case when (html+sql)/2>=80 then 1 else 0 end)*100.0/stucount)+'%' as 优秀率
from exam e,(select count(1) as stucount from stuinfo) a

⑤ 求sql 分组计算合格率问题

select 厂家,型号,不合格数量,合格数量,合格数量/((不合格数量+合格数量)/1.00) 合格率, 不合格数量/((不合格数量+合格数量)/1.00) 不良率 from (
select 厂家,型号,sum((case when 状态=7 then 数量 else 0 end))不合格数量,sum((case when 状态<>7 then 数量 else 0 end)) 合格数量 from (
select 厂家,型号,状态,SUM(数量)数量 from tab
group by 厂家,型号,状态,SUM(数量)
) t
group by 厂家,型号
) t2

⑥ 求各班各科及格率的sql语句

select 班级,课程,count(*)/40 as 及格率 from 表名 where 成绩>60 group by 班级,课程