LoslegenKostenlos starten

Evaluating charging duration

To help provide better information in their app, the development team wants to include a banner on the landing page that says something like "X% of vehicles owners charge in less than Y minutes". To do this, they need to understand the distribution of charging time at each charging station. That's where you come in!

Diese Übung ist Teil des Kurses

<Kurs>Window Functions in Snowflake</Kurs>
Kurs ansehen

Übungsanweisungen

  • Update the SELECT statement to include a window function that finds the cumulative distribution of records in the results set.
  • "Segment" records by the charging_station_id, such that a cumulative distribution is created for each.
  • Make sure the cumulative distribution generated by the charging_duration, in ascending order.

Interaktive praktische Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

SELECT
    user_id,
    charging_station_id,
    charging_duration * 60,
	
    -- Find the cumulative distribution of records in the result set
    ___ ___(
      
      	-- Segment records by charging station id
        ___
      	
      	-- Create the cumulative distribution using charging duration
        ___
      
    ) AS charging_duration_dist

FROM ELECTRIC_VEHICLES.charging
ORDER BY charging_station_id, charging_duration_dist;
Code bearbeiten und ausführen