เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Comparing energy consumed

Being able to compare records to summary metrics is one of the most powerful use cases for window functions. In this exercise, you'll build two window functions to compare each record to the minimum and maximum energy consumed.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Window Functions in Snowflake

ดูคอร์ส

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

SELECT
    user_id,
    charging_station_location,
    charger_type,
    energy_consumed,
	
    -- Find the least energy consumed in a charging session
    ___(___) OVER(
        ORDER BY ___
    ) AS least_energy_consumed

FROM ELECTRIC_VEHICLES.charging;
แก้ไขและรันโค้ด