Baselight
WITH genre_year AS (
    SELECT 
        playlist_genre AS Genre,
        EXTRACT(YEAR FROM track_album_release_date) AS Year,
        COUNT(track_id) AS Song_Count
    FROM @kaggle.joebeachcapital_30000_spotify_songs.spotify_songs
    GROUP BY 
        playlist_genre, 
        EXTRACT(YEAR FROM track_album_release_date)
)
SELECT 
    Year,
    SUM(CASE WHEN Genre = 'pop' THEN Song_Count ELSE 0 END) AS Pop,
    SUM(CASE WHEN Genre = 'rock' THEN Song_Count ELSE 0 END) AS Rock,
    SUM(CASE WHEN Genre = 'rap' THEN Song_Count ELSE 0 END) AS Rap,
    SUM(CASE WHEN Genre = 'latin' THEN Song_Count ELSE 0 END) AS Latin,
    SUM(CASE WHEN Genre = 'edm' THEN Song_Count ELSE 0 END) AS Electronic,
FROM 
    genre_year
GROUP BY 
    Year
ORDER BY 
    Year;
YearPopRockRapLatinElectronic
195701000
195801000
196000000
196100000
196201000
196304000
196408000
196508010
1966016000
1967035100
1968019200
1969150100
1970172200
1971066100
1972068100
1973197100
1974167200
1975199000
19762120110
1977195001
19787116101
1979470032
1980685001
19811466211
1982873242
19831394121
198419108120
19859111360
19861175250
198721114890
198897135160
198910565110
1990164614171
199178025121
19926394130
199375172131
1994155880111
1995134875181
1996173595131
1997128049230
19981372111211
1999186789263
200096854144
2001339459263
2002235954194
2003287298475
2004249990763
200522176126698
2006501011019216
2007501158810129
20081121427511943
200995885811845
20101731207412637
201114497808474
201217663117133170
20132278493123313
2014316105175165564
201547979235277462
201653177295375498
2017505116463396486
2018704129705567755
20191373577182418792321
202017048159131184

Share link

Anyone who has the link will be able to view this.