Last Updated: May 12, 2026
For this exercise, we will work with below data:
Find tracks whose duration_seconds is greater than the average duration of tracks on the same album. Use a correlated subquery in WHERE. Show the track title and duration_seconds, ordered by track_id
For each artist, show their name and follower count. Use a correlated subquery against artist_follows in the SELECT list. Order by follower count descending, then by name ascending.
Find each user's most recent payment. Use a correlated subquery on MAX(payment_date). Show the username, payment amount, payment_date, and status. Order by payment_date descending, then by username.
Find tracks whose duration is below the average duration of tracks on the same album. Use a correlated subquery in WHERE. Show the track title, album_id, and duration_seconds, ordered by album_id.