1. Learn
  2. /
  3. Courses
  4. /
  5. Window Functions in Snowflake

Connected

Exercise

Impact of temperature on charging rate

The data you've been interrogating with window functions isn't just insightful for your team; it's quite useful for vehicle manufacturers themselves. A number of these manufacturers have come to you interested in the impact of temperature on charging rate. They'd like a moving average of temperature, as well as a moving average for charging rate broken out by vehicle model.

Instructions

100 XP
  • Find the moving average of temperature using the two preceding records and the current row, ordered by temperature.
  • Generate another moving average, this time for charging_rate using the four preceding records and the current row, again ordered by temperature and partitioned by vehicle_model.
  • Only include records where charging_rate is not NULL.
Powered by Snowflake