One choice which does not use a window function would be to use a correlated subquery to calculate the running total:
select
t1.sub_code,
t1.Roll_no,
t1.Total_marks,
(select sum(Total_marks) from table t2
where t2.Total_marks <= t1.Total_marks) as cumulative_Total
from table t1
order by t1.Total_marks
This implies that you actually need to order the running total using the thing you are attempting to sum, namely the Total_marks. In general, you could use the below-correlated subquery if you plan to use a different column for ordering:
(select sum(Total_marks) from table t2
where t2.some_col <= t1.some_col) as cumulative_Total
Want to Learn SQL to get expertise in the concepts of SQL? Join the SQL course and get certified after clearing SQL certification exam.