Are charging durations getting longer?
The Data Science team currently has a model that predicts the number of open chargers based on average vehicle charging duration. This allows for them to send notifications to previous users when it might be a good time to charge. However, the team believes that average charging duration may have changed since the last time they trained their model. Can you validate this for them?
Den här övningen är en del av kursen
Window Functions in Snowflake
Övningsinstruktioner
- Use a window function to find the running average of vehicle
charging_duration. - Partition the results by
charging_station_location. - Sequence the window by
charging_start_timein ascending order. - Create the window of records to always be between the first row and the
CURRENT ROW.
Interaktiv övning med praktiskt arbete
Testa den här övningen genom att slutföra den här exempelkoden.
SELECT
user_id,
charging_station_location,
TO_DATE(charging_start_time),
charging_duration,
-- Find the running average of charging duration
___ OVER(
-- Partition the results by charging_station_location
___
-- Sequence the results by charging start time in ascending order
ORDER BY ___
-- Create the window of records to always be between the
-- first row and the current row
___
) AS running_average
FROM ELECTRIC_VEHICLES.charging;