zashirah/mlb-data-lake

Report: show who is involved in the most plays

Opened this issue · 1 comments

inspired by Ohtani being a high k, bb, hr, hbp batter and these only involve the batter and pitcher. No defenders. Would like to look at this for % in infield too.

Looking at a graph to understand how often position players are involved.
Could also look at:

  • how often a position player is singularly involved
  • infield vs outfield
with a as (
    select 
        player,
        sum("batting.hr") as total_hr,
        sum("batting.bb") as total_bb,
        sum("batting.so") as total_so,
        sum("batting.hbp") as total_hbp,
        sum("batting.ab") as total_ab
    from 
        fct_batting_boxscore_hist
    group by all
),
b as (
    select *,
        total_hr + total_bb + total_so + total_hbp as p_v_b
    from a
)

select *, 
    p_v_b/total_ab as pct
from b
where total_ab > 50
order by pct desc