Skip to content

Instantly share code, notes, and snippets.

@antaldaniel
Last active April 28, 2021 07:13
Show Gist options
  • Save antaldaniel/d26ec95e2156fb41f80d8e5f0fdc102b to your computer and use it in GitHub Desktop.
Save antaldaniel/d26ec95e2156fb41f80d8e5f0fdc102b to your computer and use it in GitHub Desktop.
SMDB demo queries
/*
How much more dancable are The Youniverse than the average Slovak music?
<run separately after the / sign>
*/
select(
(select avg(danceability) as [The Youniverse - Danceability] from "spotify-top-tracks" where spotify_artist_name = "The Youniverse" ) /
(select avg(danceability) as [Average Danceability] from "spotify-top-tracks") - 1
)*100 as percent
/*
What is Katarzia's favorite key?
<run separately after the / sign>
*/
select key as [Katarzia's most frequent key], count(key) Frequency
from "spotify-top-tracks" where spotify_artist_name = "Katarzia"
group by key order by count(key) desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment