Working with personal info
A new table was added to your data warehouse, which includes user-specific information. However, this data in the personal_info column of the members table is in VARIANT format, and takes the form below. Your job is to filter and parse this data into a result set that is usable for planning special offers for each member.
{
"age": "56",
"gender": "Female",
"name": {
"first": "Chris",
"last": "Wilson"
}
}
Cet exercice fait partie du cours
Data Types and Functions in Snowflake
Instructions
- Use dot-notation to retrieve a member's
agefrom thepersonal_infocolumn, and pass the value to theTO_NUMBERfunction. - Use bracket-notation to retrieve a member's gender from
personal_info. - Filter the result set to only include records for members at least 25 years old.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
SELECT
personal_info,
-- Use the TO_NUMBER function to convert the age to a NUMBER
TO_NUMBER(___:___),
-- Use bracket-notation to retrieve the member's gender
___
FROM CORE_GYM.members
-- Only retrieve members who are at least 25
___ TO_NUMBER(personal_info:age) >= ___;