Find the top-ranked songs for the past 20 years

StrataScratch

Find all the songs that were top-ranked (at first position) at least once in the past 20 years.

table name: billboard_top_100_year_end


Solution:

select distinct song_name from billboard_top_100_year_endwhere year_rank=1 and year >= Year(GETDATE()) - 20
group by song_name
Output:
where YearGETDATE
group by


SQL Script:

Script File


Comments (0)