World Cup Winners Compared
A comparison of World Cup winners across seasons that accounts for differences in the number of competitions held.
Rules
- Only the winner of each season’s World Cup standings is included.
- Each winner’s total points and number of competition performances are shown.
- Average points per performance are calculated by dividing total points by the number of performances.
The analysis uses the world_cups
view created for the season standings. Comparing average points per performance
makes the result fairer when seasons contain different numbers of competitions.
Code
with comparison as (
select
wc.season,
j.jumper_name as jumper,
wc.total_score as points,
(
select count(cr.*)
from competition_results cr
join competitions c using (race_id)
where c.season = wc.season and cr.jumper_id = j.jumper_id
) as number_of_performances
from world_cups wc
join jumpers j using (jumper_id)
where pos = 1
order by season
)
select *,
(points / number_of_performances)::decimal(10,2) as avg_points_per_performance
from comparison;