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

Connected

Exercise

Finding the most efficient composer

Here's a fun one! You're chatting with your coworker, and you decide that you want to find the artist that (on average) prices their songs the most per second. To do this, you'll use the tracks table and a Common Table Expression.

Instructions

100 XP
  • Create a Common Table Expression (CTE) called track_metrics that retrieves the composer, number of seconds and unit_price.
  • When defining track_metrics, make sure to retrieve only records with a non-empty value for composer.
  • Query the track_metrics CTE to find the average price-per-second for each composer using the formula unit_price / num_seconds.
Powered by Snowflake