知识点

  1. 使用窗函数对grade进行分组然后,使用sum() over (order by ) 开窗函数,sum(a) over (order by b) 的含义是:按照b列排序,将a依次相加

代码

select grade, sum(number) over(order by grade) as t_rank 
from class_grade 
order by grade