Last Updated: May 12, 2026
For this exercise, we will work with below data:
Using RIGHT JOIN, list every user along with their stream_id. Users with no streams should still appear with NULL for stream_id. Show username and stream_id. Order by username, then stream_id. Use streams and users.
Using RIGHT JOIN, find all tracks that have never been streamed. Show only the track title. Use streams and tracks.
Using RIGHT JOIN, list every genre with the number of albums in that genre (album_count). Include genres with zero albums. Show genre and album_count. Order by album_count descending, then genre ascending. Use albums and genres.
Using RIGHT JOIN, list every user with the count of playlists they have created (playlist_count). Include users who have created no playlists. Show username and playlist_count. Order by playlist_count descending, then username ascending. Use playlists and users.
Using RIGHT JOIN, return each artist's name along with their stream_count (total streams across all their tracks). Include artists with no streams. Show artist and stream_count. Order by stream_count descending, then artist ascending. Walk the chain streams -> tracks -> albums -> artists.