A JSON document is stored in the source_column 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?
I think the answer should be C:
Based on the output of the FLATTEN function,
+-----+------+------+-------+-------+------+
| SEQ | KEY | PATH | INDEX | VALUE | THIS |
|-----+------+------+-------+-------+------|
Key is the second output, therefore source_column:elements[1].name should point to the key. Not sure though :\
This is not related to the FLATTEN function. This is merely a question on traversing semi-structured datatypes:
https://docs.snowflake.com/en/user-guide/querying-semistructured
Insert a colon : between the VARIANT column name and any first-level element: <column>:<level1_element>.
There are two ways to access elements in a JSON object:
Dot Notation
Bracket Notation
Retrieve a specific numbered instance of a child element in a repeating array by adding a numbered predicate (starting from 0) to the array reference.
so the answer is D
upvoted 1 times
...
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Heetec
Highly Voted 8 months, 2 weeks agoSSahar
Most Recent 3 months, 2 weeks agoSSahar
3 months, 2 weeks agoahadh7621
4 weeks ago