Describe how you would solve a SQL coding problem involving joins, aggregation, and ranking or filtering logic.
Using the provided tables, write a query that evaluates qualifying artist performance for January 2026.
Output
- Return one row per qualifying artist with
artist_name, genre, total_streams, genre_rank, and unique_listeners.
- Include artists with at least two distinct listeners, return the top two ranks per genre including ties, and order by
genre, genre_rank, and artist_name.
Output details
- Use
2026-01-01 inclusively through 2026-02-01 exclusively for the January 2026 date range.
- Rank artists within each genre by
total_streams descending using competition ranking, preserving ties.
- Sort
genre, genre_rank, and artist_name ascending.
- Define
total_streams as the count of non-NULL stream_id values and unique_listeners as distinct non-NULL listener_id values.