exam questions

Exam SnowPro Core All Questions

View all questions & answers for the SnowPro Core exam

Exam SnowPro Core topic 1 question 823 discussion

Actual exam question from Snowflake's SnowPro Core
Question #: 823
Topic #: 1
[All SnowPro Core Questions]

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?

  • A. source_column.elements[1]:name
  • B. source_column.elements[0]:name
  • C. source_column:elements[1].name
  • D. source_column:elements[0].name
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Heetec
Highly Voted 8 months, 2 weeks ago
Selected Answer: D
D correct
upvoted 5 times
...
SSahar
Most Recent 3 months, 2 weeks ago
Selected Answer: C
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 :\
upvoted 1 times
SSahar
3 months, 2 weeks ago
D is correct
upvoted 1 times
ahadh7621
4 weeks ago
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
...
...
...
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.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago