1. Learn
  2. /
  3. Courses
  4. /
  5. Data Manipulation in Snowflake

Connected

Exercise

Finding the most popular artists

Something that we haven't been able to do is tie track sales to an artist. Let's change that! You're about to get hands-on using common table expressions to take data from two tables and find the artist with the most minutes listened. Before you get started, make sure to take a peek at the album and artist tables in the output window.

Instructions

100 XP
  • Define an artist_info CTE that JOINs the artist and album tables on the artist_id field.
  • Create a second CTE called track_sales that retrieves the album_id, name, and number of seconds per track from the track table.
  • Calculate the total minutes listened for each artist.
  • Group the results on artist_name from the appropriate CTE.
Powered by Snowflake