ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Window Functions in Snowflake

Ver curso

Instrucciones del ejercicio

  • 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.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

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;
Editar y ejecutar código