Back to questions

SQL Tutorial Lesson: Top-Selling Artists SQL Interview Question

SQL Tutorial Lesson: Top-Selling Artists

SQL Interview Question

As the lead data analyst for a prominent music event management company, you have been entrusted with a dataset containing concert revenue and detailed information about various artists.

Your mission is to unlock valuable insights by analyzing the concert revenue data and identifying the top revenue-generating artists within each music genre.

Write a query to rank the artists within each genre based on their revenue per member and extract the top revenue-generating artist from each genre. Display the output of the artist name, genre, concert revenue, number of members, and revenue per band member, sorted by the highest revenue per member within each genre.

Schema:

Column NameTypeDescription
artist_idintegerA unique identifier for each artist or band performing in the concert.
artist_namevarchar(100)The name of the artist or band performing in the concert.
genrevarchar(50)The music genre associated with the concert.
concert_revenueintegerThe total revenue generated from the concert.
year_of_formationintegerThe year that the artist or band was formed.
countryvarchar(50)The country of origin or residence of the artist or band.
number_of_membersintegerThe number of members in the band.
album_releasedintegerThe total number of albums released by the artist or band.
labelvarchar(100)The record label or music company associated with the artist or band.

Example Input:

artist_idartist_namegenreconcert_revenueyear_of_formationcountrynumber_of_membersalbum_releasedlabel
103Taylor SwiftPop7000002004United States19Republic Records
104BTSK-Pop8000002013South Korea77Big Hit Music
105AdelePop6000002006United Kingdom13Columbia Records
109BlackpinkK-Pop4500002016South Korea45YG Entertainment
110Maroon 5Pop5500001994United States57Interscope Records

Difficulty

Medium

Input

Output