Listeners who played both jazz and folk
The task
Editorial wants to build a crossover playlist and asks how many listeners already enjoy both worlds, by country.
A listener enjoyed a genre when they have at least one play of 30 seconds or more (seconds_played >= 30) of a track by an artist of that genre.
Count the listeners who enjoyed both 'jazz' and 'folk'. Return country (the listener's country) and listeners, only for countries with at least one such listener. Sort by listeners descending, then country ascending.
Expected output
countrylisteners- Sorted by listeners descending, then country ascending.
- Checked on the sample and on 2 hidden datasets. How grading works
Tables Music streaming service · click a name to insert it
listeners180 rows in the sample
One row per listener account. Key: listener_id.
| int | Unique id. | |
| date | Day they joined. | |
| text | Two-letter country code. | |
| text | free, premium or family. |
artists30 rows in the sample
One row per artist. Key: artist_id.
| int | Unique id. | |
| text | Name. | |
| text | pop, rock, hip-hop, electronic, jazz or folk. |
tracks116 rows in the sample
One row per track. Key: track_id.
| int | Unique id. | |
| text | Track title. | |
| int | Main artist. | |
| int | Length. | |
| date | Release day. |
plays6,555 rows in the sample
One row per play. Key: play_id.
| bigint | Unique id. | |
| int | Who listened. | |
| int | What. | |
| timestamp | Start time (UTC). | |
| int | How long they listened. | |
| text | phone, desktop, speaker or car. |
Related questions
- Free and paid listeners per genremedium
- Plays in the first two weeks for April joinerseasy
- Tracks and plays per jazz artist without double countingmedium
- April spend and cost per click for search and socialeasy
- Completed trips for every city and vehicle typemedium
- Daily spend against sign-ups for one campaignhard
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL