Back to feed

Project docs

Ski Jumping Statistics

PostgreSQL analysis of men's Ski Jumping World Cup results, supported by a Python data collection pipeline.

Largest Winning Margins

The World Cup victories with the greatest points difference between the winner and the runner-up.

Rules

  • The winner and runner-up are selected from each competition’s final results.
  • The winning margin is the winner’s total points minus the runner-up’s total points.
  • Competitions are ranked from the largest winning margin downward.

The calculation uses final positions and total points from the competition_results materialized view.

Calculating each margin

create view advantages_over_second_player
as
with top_results as (
	select *,
		row_number() over (partition by race_id order by total_points desc) as rn
	from competition_results
	where pos < 3
)
select
	c.race_id,
	first_place.jumper_id as first_place_jumper_id,
	second_place.jumper_id as second_place_jumper_id,
	(first_place.total_points - second_place.total_points)::decimal(10, 2) as advantage
from competitions c
join top_results as first_place on
	first_place.race_id = c.race_id and first_place.rn = 1
join top_results as second_place on
	second_place.race_id = c.race_id and second_place.rn = 2;

Raw view presentation

Raw advantages_over_second_player view returned by PostgreSQL0 rows

Top 10 winning margins

select
	to_char(c.competition_started, 'Mon DD YYYY') as date,
	c.hill_city || ' HS' || c.hill_size as hill,
	j1.jumper_name as first_place,
	j2.jumper_name as second_place,
	aosp.advantage
from advantages_over_second_player aosp
join competitions c using (race_id)
join jumpers j1 on aosp.first_place_jumper_id = j1.jumper_id
join jumpers j2 on aosp.second_place_jumper_id = j2.jumper_id
order by aosp.advantage desc
limit 10;

Results

Largest winning margins returned by PostgreSQL0 rows