--moving average
With US_medals as ()

select year,medals,
  avg(medals)over(order by year asc rows between 2 preceding and current row) as medasls_MA
from US_medals
order by year asc;

--moving total
With US_medals as ()

select year,medals,
  sum(medals)over(order by year asc rows between 2 preceding and current row) as medasls_MT
from US_medals
order by year asc;