各位这个 1 、4.1、6 这三个怎么写啊,有没有会写的,帮我看看吧,这个大数据实在没学过,这个语法不知道啊


各位这个 1 、4.1、6 这三个怎么写啊,有没有会写的,帮我看看吧,这个大数据实在没学过,这个语法不知道啊


##1
select 行政班号,avg(总分) 平均分
from tablename where 专业代码='SC'
group by 行政班号
order by 平均分 desc
limit 1
##4.1
select case when 科目一分数>=20*0.9 then 'A' when 科目一分数>=20*0.8 then 'B' when 科目一分数>=20*0.7 then 'C' when 科目一分数>=20*0.6 then 'D' else 'E' end 等级,count(*) 人数
from tablename
group by case when 科目一分数>=20*0.9 then 'A' when 科目一分数>=20*0.8 then 'B' when 科目一分数>=20*0.7 then 'C' when 科目一分数>=20*0.6 then 'D' else 'E' end
##6
select 行政班号,count(distinct distinct 学号) 人数
from tablename
group by 行政班号
order by 人数 desc