Last Updated: May 12, 2026
For this exercise, we will work with below data:
Show every track's title and the number of times it has been streamed. Tracks with no streams must appear with a count of 0. Order by stream_count descending, then by track title.
Show every user with the number of playlists they have created. Users who have created none must show 0. Order by playlist_count descending, then by username.
Show every artist's name and total stream count across all their tracks. Include artists with zero streams (such as Quiet Echo, who has no albums). Order by total_streams descending, then by name.
Show every user's username and the total seconds they have listened (sum of duration_listened). Users with no streams must show 0, not NULL. Use COALESCE. Order by total_seconds descending, then by username.
Show every user's username, the count of distinct tracks they have streamed, and the count of playlists they have created. Include users with zero of either. Avoid the Cartesian inflation that comes from joining two independent one-to-many relationships by using COUNT(DISTINCT ...). Order by username