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

Connected

Exercise

Albums driving sales

Your director came up to your desk today and gave you the inside scoop on a holiday promotion on "Greatest Hits" albums that will be dropping soon. However, to make sure the optimal albums are discounted, she wants to know which "Greatest Hits" albums drive the most sales. To do this, you'll put all the skills you learned to the test!

Instructions

100 XP
  • Define a CTE called album_map.
  • Create a CASE statement that returns TRUE if greatest is in an album's title and FALSE otherwise, aliasing as is_greatest_hits.
  • Update the trimmed_invoicelines CTE, LEFT JOINing the invoice and tracks table to invoicelines on invoice_id and track_id respectively.
  • Use a subquery to only return "Greatest Hits" albums.
Powered by Snowflake