select
a.grade
,sum(a.number) over (order by grade)
from (
select
*
from class_grade
order by grade
) a