select
s.season
,s.rank
,s.team_name
,s.team_abbr
--- data clean up for logo, not a perfect join, use case when to fill in blanks
,case
when s.team_name = 'Manchester City' then 'https://resources.premierleague.com/premierleague/badges/t43.png'
when s.team_name = 'Manchester United' then 'https://resources.premierleague.com/premierleague/badges/t1.png'
else l.logo end as team_logo
--- data clean up for team color, not a perfect join, use case when to fill in blanks
,case
when s.team_name='Wolverhampton Wanderers' then '#fdb913'
when s.team_name='Norwich City' then '#fff200'
when s.team_name = 'Leicester City' then c.team_color_2
when c.team_color_1 IS NULL then 'grey'
else c.team_color_1 end as team_color
,rank() over (partition by team_name order by season) as first_season
,rank() over (partition by team_name order by season desc) as last_season
from seasons s
left join colors c on c.team = s.team_name
left join logos l on l.abbr = s.team_abbr
where s.season>=2018