Last Updated: May 10, 2026
For this exercise, we will work with below data:
Extract the year from each album's release_date in the albums table. Show title and release_year. Order by release_year, then title.
Compute each user's account age in days as of 2025-01-01. Use the users table. Show username and days_active, ordered by days_active descending.
Count the streams that occurred in the first quarter of 2024 (January, February, March). Return a single row with q1_streams.
Find subscriptions that lasted at least 350 days. Use the subscriptions table; treat NULL end_date as still active by using 2025-01-01 as the cutoff. Return subscription_id, user_id, and days_active, ordered by days_active descending.
For each campaign in the campaigns table, compute its planned duration in days. For campaigns with no end_date, treat the duration as the difference between 2025-01-01 and start_date. Show name, start_date, end_date, and duration_days. Order by name.