ExamGecko
Question list
Search
Search

Question 555 - SnowPro Core discussion

Report
Export

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?

A.

Source_column.element[1]:name

Answers
A.

Source_column.element[1]:name

B.

Source_column.element[0]:name

Answers
B.

Source_column.element[0]:name

C.

Source_column.element[1].name

Answers
C.

Source_column.element[1].name

D.

Source_column.element[0]:name

Answers
D.

Source_column.element[0]:name

Suggested answer: C

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 referenced with [0]. Therefore, to extract the name from the first element of the elements array, the correct syntax is Source_column:elements[0].name.

Reference: Snowflake Documentation on Semi-Structured Data

asked 29/10/2024
Asif Ali
34 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first