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

Connected

Exercise

Inferring purchase quantity

Now that you've played around with the tracks table, it's time to check out something new. The invoice table shows the total amount tendered as part of the transactions, but it doesn't say how many songs were bought. You'll fix that using a CASE statement to determine if a customer bought more than one song in a single transaction. An important little tidbit of information: there are only two different unit prices for a song (0.99 and 1.99).

Instructions

100 XP
  • When the total amount of the invoice is either 0.99 or 1.99, classify as '1 Song' purchased.
  • If the condition above is not true, then label as '2+ Songs', reflecting how many songs were purchased in a single transaction.
  • The new column should be called number_of_songs.
Powered by Snowflake