nerdexam
Snowflake

COF-C02 · Question #395

A JSON object is loaded into a column named data using a Snowflake variant datatype. The root node of the object is BIKE. The child attribute for this root node is BIKEID. Which statement will allow…

The correct answer is C. select data:BIKE.BIKEID. In Snowflake, when accessing elements within a JSON object stored in a variant column, the correct syntax involves using a colon (:) to navigate the JSON structure. The BIKEID attribute, which is a child of the BIKE root node in the JSON object, is accessed using…

Data Transformations

Question

A JSON object is loaded into a column named data using a Snowflake variant datatype. The root node of the object is BIKE. The child attribute for this root node is BIKEID. Which statement will allow the user to access BIKEID?

Options

  • Aselect data:BIKEID
  • Bselect data.BIKE.BIKEID
  • Cselect data:BIKE.BIKEID
  • Dselect data:BIKE:BIKEID

How the community answered

(37 responses)
  • A
    14% (5)
  • B
    3% (1)
  • C
    76% (28)
  • D
    8% (3)

Explanation

In Snowflake, when accessing elements within a JSON object stored in a variant column, the correct syntax involves using a colon (:) to navigate the JSON structure. The BIKEID attribute, which is a child of the BIKE root node in the JSON object, is accessed using data:BIKE.BIKEID. This syntax correctly references the path through the JSON object, utilizing the colon for JSON field access and dot notation to traverse the hierarchy within the variant structure.

Topics

#JSON#VARIANT Data Type#Semi-structured Data#SQL Querying

Community Discussion

No community discussion yet for this question.

Full COF-C02 Practice