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

Surveying vehicle owners

Your market research team is interested in surveying vehicle owners to get a better understanding of their behavior. They'd like to be strategic about this and generate a well-represented sample. They'd like you to prepare 100 groups of vehicle owners, based on the amount each owner spent charging their vehicles. Give it a shot!

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

Window Functions in Snowflake

ดูคอร์ส

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

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

SELECT
    user_id,
    charging_station_location,
    charging_cost,
    
    -- Break records into 100 equally-sized buckets based on
    -- charging_cost
    ___(___) OVER(
      ORDER BY ___
    ) AS survey_group
    
FROM ELECTRIC_VEHICLES.charging

-- Order by survey_group and charging_station_location
ORDER BY ___, ___;
แก้ไขและรันโค้ด