开始使用免费开始使用

哪种训练消耗的热量更多?

您想了解一些关于训练的高层信息。比如总消耗热量与平均消耗热量等数值,能为想要充分利用训练效果的会员提供参考。幸运的是,您已经具备完成这项工作的工具!

本练习是课程的一部分

Snowflake 中的数据类型与函数

查看课程

练习说明

  • 计算每种 workout_typecalories_burned 总和。
  • 定义一列,存储每种 workout_typecalories_burned 平均值。
  • 新增一列,存储四舍五入到小数点后 2 位的 calories_burned 平均值。
  • workout_type 聚合记录,以避免抛出错误。

交互式实操练习

通过完成这段示例代码来试试这个练习。

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
___;
编辑并运行代码