Last Updated: May 12, 2026
For this exercise, we will work with below data:
Write a query that returns the title and stream count of the track with the highest stream count, including all tracks tied at that count. Use DENSE_RANK. Order by title.
Write a query that returns the 3rd longest track using LIMIT and OFFSET. Show title and duration_seconds. Return exactly one row.
Write a query that returns every track tied at the 2nd highest stream count. Use a CTE with DENSE_RANK. Show title and stream_count. Order by title.
Write a query that returns the user with the 3rd highest total listening time (sum of duration_listened). Use DENSE_RANK. Show username and total_listened.
Write a query that returns the 2nd lowest distinct duration_seconds value among all tracks, including every track that matches it. Use DENSE_RANK ordered ascending. Show title and duration_seconds. Order by title.