The data team discovered that some artists have tracks in multiple genres. Find these cross-genre artists and show which genres they span.
| Column | Type |
|---|---|
| ArtistId | INTEGER (Primary Key) |
| Name | TEXT |
| Column | Type |
|---|---|
| AlbumId | INTEGER (Primary Key) |
| Title | TEXT |
| ArtistId | INTEGER (Foreign Key → Artist.ArtistId) |
| Column | Type |
|---|---|
| TrackId | INTEGER (Primary Key) |
| Name | TEXT |
| AlbumId | INTEGER (Foreign Key → Album.AlbumId) |
| MediaTypeId | INTEGER (Foreign Key) |
| GenreId | INTEGER (Foreign Key → Genre.GenreId) |
| Composer | TEXT |
| Milliseconds | INTEGER |
| Bytes | INTEGER |
| UnitPrice | NUMERIC(10,2) |
| Column | Type |
|---|---|
| GenreId | INTEGER (Primary Key) |
| Name | TEXT |
STRING_AGG(DISTINCT g.Name, ',') to list genresArtistName, GenreCount, Genres, TrackCountReady to take your skills to the next level? Enroll in our comprehensive Data Analyst Career Track to master SQL, Python, Excel, and Power BI.
Run your code to see the result here.