哪种训练消耗的热量更多?
您想了解一些关于训练的高层信息。比如总消耗热量与平均消耗热量等数值,能为想要充分利用训练效果的会员提供参考。幸运的是,您已经具备完成这项工作的工具!
本练习是课程的一部分
Snowflake 中的数据类型与函数
练习说明
- 计算每种
workout_type的calories_burned总和。 - 定义一列,存储每种
workout_type的calories_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
___;