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"
}
}
Diese Übung ist Teil des Kurses
Data Types and Functions in Snowflake
Anleitung zur Übung
- Use dot-notation to retrieve a member's
age
from thepersonal_info
column, and pass the value to theTO_NUMBER
function. - 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.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
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) >= ___;