189 8069 5689

mysql怎么求及格率,数据库求及格率

SQL语句求助,查询出每门课程及格和不及格的人数

---以下在SQL2005执行通过--

为龙安等地区用户提供了全套网页设计制作服务,及龙安网站建设行业解决方案。主营业务为成都网站设计、成都网站建设、龙安网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

---结果将以 科目、及格数、不及格数 显示

select * from

(select col2,count(*) as [及格数]

from tb

where col1=60

group by col2

)t

outer apply

(select count(*) as [不及格数]

from tb

where col160 and t.col2= col2

group by col2

)m

-----这应该是楼主想要的了吧。

mysql怎么求它的平均成绩,在线等,请高手指教?

写了一下,你试试行不行

select name,avg(grade) from 表的名称 group by name;

打印出来的是每个人对应的平均成绩。

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

select convert(varchar(10),sum(case when (html+sql)/2=60 and (html+sql)/280 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

mysql 不及格率

select name, 

100*sum(case 

when mark=60 

then 1 else 0 

end)/count(*) 及格率 

from score 

group by name

求SQL 班级及格率

mysql select class,concat(cast(sum(jige)/count(*)*100 as decimal(4,2)),'%') as

'及格率' from (select class,if (score=60,1,0) as jige from class) as t group by class;

怎样用查询语句在数据库表中求及格率

没有考虑成绩表中一个人有多条课程的成绩记录的情况,应在之前查询方法上加上约束,如某班某课程中及格人数占总人数的百分比,即select (select COUNT(*) from Score where Cno=144502 and Cono=011 and Grade=60)/(select COUNT(*) from Score where Cno=144502 and Cono=011)

通常成绩表中的数据项为学号,课程号,成绩,班级号 ,当一个人选了多门课有及格的也有不及格的时,仅仅靠楼上的回答不足以完成正确的查询,查询时要注意约束条件


分享文章:mysql怎么求及格率,数据库求及格率
文章路径:http://cdxtjz.cn/article/heooei.html

其他资讯