select 1 as 序号,"平均分" as 统计项目,avg(a.语文) as 语文,avg(a.数学) as 数学,avg(a.英语) as 英语
from 成绩表 as a
union all
select 2 as 序号,"及格率" as 统计项目,(select count(*) from 成绩表 where 语文>=60)/count(*) as 语文,(select count(*) from 成绩表 where 数学>=60)/count(*) as 数学,(select count(*) from 成绩表 where 英语>=60)/count(*) as 英语
union all
select 3 as 序号,"优秀率" as 统计项目,(select count(*) from 成绩表 where 语文>=90)/count(*) as 语文,(select count(*) from 成绩表 where 数学>=90)/count(*) as 数学,(select count(*) from 成绩表 where 英语>=90)/count(*) as 英语
union all
select 4 as 序号,"90分以上" as 统计项目,(select count(*) from 成绩表 where 语文>=90) as 语文,(select count(*) from 成绩表 where 数学>=90) as 数学,(select count(*) from 成绩表 where 英语>=90) as 英语
union all
select 5 as 序号,"80~89分" as 统计项目,(select count(*) from 成绩表 where 语文>=80 and 语文<90) as 语文,(select count(*) from 成绩表 where 数学>=80 and 数学<90) as 数学,(select count(*) from 成绩表 where 英语>=80 and 英语<90) as 英语
union all
select 6 as 序号,"70~79分" as 统计项目,(select count(*) from 成绩表 where 语文>=70 and 语文<80) as 语文,(select count(*) from 成绩表 where 数学>=70 and 数学<80) as 数学,(select count(*) from 成绩表 where 英语>=70 and 英语<80) as 英语
union all
select 7 as 序号,"60~69分" as 统计项目,(select count(*) from 成绩表 where 语文>=60 and 语文<70) as 语文,(select count(*) from 成绩表 where 数学>=60 and 数学<70) as 数学,(select count(*) from 成绩表 where 英语>=60 and 英语<70) as 英语
union all
select 6 as 序号,"60分以下" as 统计项目,(select count(*) from 成绩表 where 语文<60) as 语文,(select count(*) from 成绩表 where 数学<60) as 数学,(select count(*) from 成绩表 where 英语<60) as 英语
union all
select 7 as 序号,"最高分" as 统计项目,max(a.语文) as 语文,max(a.数学) as 数学,max(a.英语) as 英语
from 成绩表 as a
union all
select 8 as 序号,"最低分" as 统计项目,min(a.语文) as 语文,min(a.数学) as 数学,min(a.英语) as 英语
from 成绩表 as a