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.
Cet exercice fait partie du cours
Window Functions in Snowflake
Instructions
- Determine the charging cost of the first charge at each station, based on the
charging_start_time
. - Find the average
charging_cost
for each charging station.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
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;