Lightning charger load
The machine learning team is interested in predicting the energy consumed in a charger's next session, with the goal of routing power to the chargers who might be taxed in the future. To train a model, they'd like you to prepare a dataset that includes information about the user, vehicle model, charging station, and energy consumed that "looks" forward to the next charge. Time to show them what you've got!
Bu egzersiz
Window Functions in Snowflake
kursunun bir parçasıdırEgzersiz talimatları
- Retrieve the
time_of_day,charging_rate, andenergy_consumedfor each record from theELECTRIC_VEHICLES.chargingtable. - Use a window function to "look ahead" and retrieve the energy consumed in the next charging session; return
0if not found. - Segment the records by
charging_station_idand use thecharging_start_timeto create a sequence of records, in ascending order.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
SELECT
user_id,
charging_station_id,
charging_start_time,
-- Retrieve the time_of_day, charging_rate and energy_consumed fields
___,
___,
___,
-- "Look ahead" to the energy consumed in the next session
___ OVER(
-- Segment the records by charging station and sequence
-- records by the start time of the charge
___
___
) AS next_session_energy_consumed
FROM ELECTRIC_VEHICLES.charging;