spotify-metadata-parquet / code /example_queries.sql
alpha31476's picture
Add dataset card, analysis code, and release documentation
9a1f607 verified
Raw History Blame Contribute Delete
1.01 kB
-- Run one statement at a time with query_spotify.py --sql "...".
SELECT rowid, id, name, popularity, duration_ms
FROM tracks
LIMIT 20;
SELECT track_id, tempo, energy, danceability, acousticness, valence
FROM track_audio_features
WHERE null_response = 0
LIMIT 20;
SELECT t.id, t.name AS track_name, t.popularity,
a.name AS album_name, a.release_date
FROM tracks AS t
LEFT JOIN albums AS a ON a.rowid = t.album_rowid
LIMIT 20;
SELECT t.id, t.name AS track_name, a.name AS artist_name,
a.popularity AS artist_popularity, g.genre
FROM tracks AS t
JOIN track_artists AS ta ON ta.track_rowid = t.rowid
JOIN artists AS a ON a.rowid = ta.artist_rowid
LEFT JOIN artist_genres AS g ON g.artist_rowid = a.rowid
LIMIT 20;
-- Genres belong to artists. A track can have several artists and genres.
-- Feature IDs join to tracks.id, not to the SQLite rowid.
SELECT t.id, t.name, t.popularity, f.tempo, f.energy, f.danceability
FROM tracks AS t
JOIN track_audio_features AS f ON f.track_id = t.id
LIMIT 20;