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
WHERE YEAR > 2000 AND YEAR<2020
GROUP BY 
    Year
ORDER BY 
    Year;
YearPopRockRapLatinElectronic
2001339459263
2002235954194
2003287298475
2004249990763
200522176126698
2006501011019216
2007501158810129
20081121427511943
200995885811845
20101731207412637
201114497808474
201217663117133170
20132278493123313
2014316105175165564
201547979235277462
201653177295375498
2017505116463396486
2018704129705567755
20191373577182418792321

Share link

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