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

Connected

Exercise

Analyzing track length

Previously, you used a subquery to find the average length of songs, in milliseconds, for each genre. Now, you're going to do something similar with a common table expression, but this time, with a bit more attention to detail. Let's get to it!

Instructions

100 XP
  • Write a common table expression with the name track_lengths to retrieve the name field from store.genre, as well as the genre_id and milliseconds from the store.track table.
  • Find the average track_length, in seconds, for each genre using the track_lengths common table expression.
  • Sort the results by the average track length, from longest to shortest.
Powered by Snowflake