COF-C02 · Question #524
A JSON document is stored in the source_colum of type VARIANT. The document has an array called elements. The array contains the name key that has a string value How can a Snowflake user extract the…
The correct answer is C. Source_column.element[1].name. In Snowflake, when dealing with semi-structured data such as a JSON document stored in a VARIANT column, the proper syntax to extract a value is to use the column name followed by the path to the specific element. Since arrays in JSON are zero-indexed, the first element is the…
Question
A JSON document is stored in the source_colum of type VARIANT. The document has an array called elements. The array contains the name key that has a string value How can a Snowflake user extract the name from the first element?
Options
- ASource_column.element[1]:name
- BSource_column.element[0]:name
- CSource_column.element[1].name
- DSource_column.element[0]:name
How the community answered
(20 responses)- A10% (2)
- B5% (1)
- C80% (16)
- D5% (1)
Explanation
In Snowflake, when dealing with semi-structured data such as a JSON document stored in a VARIANT column, the proper syntax to extract a value is to use the column name followed by the path to the specific element. Since arrays in JSON are zero-indexed, the first element is the correct syntax is Source_column:elements[0].name.
Topics
Community Discussion
No community discussion yet for this question.