
Answer-first summary for fast verification
Answer: mycolumn:key.subkey, mycolumn:key:subkey
The question asks for two notations that retrieve 'value' from the VARIANT column `mycolumn` containing the JSON object { 'key': { 'subkey': 'value' }}. According to Snowflake documentation for querying semi-structured data, the colon (:) is used for path notation to traverse VARIANT columns, while dot notation (.) accesses object properties. Option C (mycolumn:key.subkey) uses path notation with dot notation for nested access, and Option E (mycolumn:key:subkey) uses path notation with colons for nested access, both correctly retrieving 'value'. Option D (mycolumn['key'].subkey) also works in practice but mixes bracket and dot notation, which is less standard per documentation. Options A and B are invalid syntax. The community discussion shows 71% consensus for CE, with upvoted comments confirming C and E align with Snowflake's recommended path notation using colons.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
Given the statement:
SELECT { 'key': { 'subkey': 'value' }} AS mycolumn;
SELECT { 'key': { 'subkey': 'value' }} AS mycolumn;
Which notations will retrieve the value 'value' from the VARIANT column mycolumn? (Choose two.)
A
mycolumn.key.subkey
B
mycolumn.key:subkey
C
mycolumn:key.subkey
D
mycolumn['key'].subkey
E
mycolumn:key:subkey
No comments yet.