Loading...Loading chart...
1WITH ranked_players AS (
2    SELECT
3        season,
4        player_id,
5        player,
6        pts_per_game,
7        x3p_per_game,
8        x2p_per_game,
9        ft_per_game,g,
10        ROW_NUMBER() OVER (
11            PARTITION BY season
12            ORDER BY pts_per_game DESC
13        ) AS rn
14    FROM @kaggle.sumitrodatta_nba_aba_baa_stats.player_per_game
15)
16SELECT
17    season,
18    -- 3 points total for the top 10 players
19    SUM(x3p_per_game * 3 * g) AS total_3p_points,
20    -- 2 points total for the top 10 players
21    SUM(x2p_per_game * 2 * g) AS total_2p_points,
22    -- Free throw total for the top 10 players
23    SUM(ft_per_game * g)      AS total_ft_points
24FROM ranked_players
25WHERE rn <= 10 AND season>2000 and season<2025
26GROUP BY season
27ORDER BY season;
28