Correct Running Total
The cats must be ordered by weight descending and will enter an elevator one by one. We would like to know what the running total weight is.
If two cats have the same weight they must enter separately
Return: name, running total weight
Order by: weight desc Show Table Schema
Correct output but can you use 'unbounded preceding'?
Use Unbounded Preceding to make sure you don't include extra rows if 2 rows evaluate to the same thing next question
select name, sum(weight) over (order by weight DESC ROWS between unbounded preceding and current row) as running_total_weight from cats order by running_total_weight