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

What burns more calories?

You're interesting in uncovering a bit of high-level information around workouts. Values like the total and average number of calories burned could provide insight to gym members who are looking to get the most out of their workouts. Luckily, you have the tools to do so!

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

Data Types and Functions in Snowflake

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Find the total sum of calories_burned for each workout_type.
  • Define a new column that stores the average number of calories_burned for each workout_type.
  • Create a column that stores the average number of calories_burned, rounded to two decimal places.
  • Aggregate the records by workout_type to ensure an error is not thrown.

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

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

SELECT
    workout_type,
    
    -- Find the total number of calories burned
    ___ AS total_calories_burned,
    
    -- Store the average calories burned
    ___ AS avg_calories_burned,
    
    -- Round the average calories burned to 2 decimal points
    ___(___, ___) AS rounded_avg_calories_burned
    
FROM CORE_GYM.visits

-- Aggregate records by workout_type
___;
แก้ไขและรันโค้ด