Created
July 23, 2020 16:56
-
-
Save Haumer/2f8f11df1ca097d5e5dbc3610272cdec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Customer list | |
| SELECT first_name, last_name, email FROM customers | |
| ORDER BY last_name | |
| # Classical Playlist | |
| SELECT tracks.name, tracks.composer FROM playlist_tracks | |
| JOIN tracks ON tracks.id = playlist_tracks.track_id | |
| JOIN playlists ON playlists.id = playlist_tracks.playlist_id | |
| WHERE playlists.name = "Classical" | |
| # Top 10 artists in Playlists | |
| SELECT artists.name, COUNT(*) AS occurances FROM artists | |
| JOIN albums ON albums.artist_id = artists.id | |
| JOIN tracks ON tracks.album_id = albums.id | |
| JOIN playlist_tracks ON playlist_tracks.track_id = tracks.id | |
| GROUP BY artists.name | |
| ORDER BY occurances DESC | |
| LIMIT 10 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment