Problem Description –
Write an SQL query to find the total score for each gender on each day.
Return the result table ordered by gender
and day
in ascending order.
The query result format is in the following example.


Difficulty Level – Medium
Problem Link – Running Total
Solution –
SELECT
gender,
day,
SUM(score_points) OVER(PARTITION BY gender ORDER BY day) as total
FROM Scores
Here, we have to simply use the SUM window function and partition the data by Gender and order the result by day in ascending order.