IniziaInizia gratis

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"
      }
}

Questo esercizio fa parte del corso

Data Types and Functions in Snowflake

Visualizza il corso

Istruzioni dell'esercizio

  • Use dot-notation to retrieve a member's age from the personal_info column, and pass the value to the TO_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.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

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) >= ___;
Modifica ed esegui il codice