一、查询季度平均
sql语句如下:
select jidu,avg(num)
from
(select *,
case when id<4 then 1 when id<7 then 2
when (id>6 and id<10) then 3 when id>9 then 4 end as jidu
from test1) test1new group by jidu
二、查询第三名学生信息
select * from
(select *,row_number() over(order by score desc)as cid from status)aa
where aa.cid=3
解释:status:学生信息表(id,score)id和分数两个字段