激勵會員行銷
為了鼓勵健身房會員回流,行銷團隊想在會員完成訓練後發送通知。你的任務是自動化產生這些訊息,方便快速整合到他們的 App。
訊息格式應類似這樣:On <date> you burned <calories burned> calories via <workout type>。
本練習屬於課程
Snowflake 的資料型別與函式
練習說明
- 使用合適的函式將多個文字值連接成一則訊息。
- 將
visits資料表中的calories_burned加入訊息中。 - 在訊息中包含會員此次造訪的
workout_type,並將結果取別名為message。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
SELECT
v.user_id,
g.location,
-- Concatenate the following strings to create a sentence
___(
'Congrats! On ',
DATE(v.checkin_time),
' you burned ',
v.___, -- Add the calories burned
' calories via ',
v.___ -- Add the workout type
) AS message
FROM CORE_GYM.visits AS v
JOIN CORE_GYM.gyms AS g
ON v.gym_id = g.gym_id;