Digging into charging costs
Let's take it a level deeper! Previously, you provided a ranking for each charging station based on the cost of each charge. Now, let's find a bit more information about the charging cost for sessions at each charging station.
Latihan ini adalah bagian dari kursus
Window Functions in Snowflake
Petunjuk latihan
- Determine the charging cost of the first charge at each station, based on the
charging_start_time. - Find the average
charging_costfor each charging station.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
SELECT
user_id,
charging_station_id,
charging_cost,
-- Based on the charging_start_time, find the first
-- charging cost for each location
___(___) OVER(
PARTITION BY charging_station_id
ORDER BY ___
) AS first_charging_cost,
-- Find the average charging cost for charging station id
___(___) ___(
___ ___ ___
) AS average_charging_cost
FROM ELECTRIC_VEHICLES.charging
ORDER BY charging_station_id;