Popular genre (a SQL question)

Question

Below is table for a popular music streaming application:

Table 1: user_song_log

Column Name Data Type Description
user_id id id of the streaming user
timestamp integer timestamp of when the user started listening to the song, epoch seconds
song_id integer id of the song
artist_id integer id of the artist

Table 2: song_info

Column Name Data Type Description
song_id integer id of the song
artist_id integer id of the artist
song_length integer length of song in seconds
song_genre string genre of song

Can you write a query to get the top genre by percent of total minutes listened across all users? Your query should return the top song_genre and the percent of total listen time.

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now