COF-C02 · Question #133
The following JSON is stored in a VARIANT column called src of the CAR_SALES table: A user needs to extract the dealership information from the JSON. How can this be accomplished?
The correct answer is B. select src.dealership from car_sales. In Snowflake, VARIANT columns support dot notation to navigate JSON fields: SELECT src.dealership FROM car_sales; (B). Snowflake also supports colon notation (src:dealership), but between the given options, B uses the correct dot notation with matching case. Option A…
Question
The following JSON is stored in a VARIANT column called src of the CAR_SALES table:
A user needs to extract the dealership information from the JSON. How can this be accomplished?
Exhibit
Options
- Aselect src:dealership from car_sales;
- Bselect src.dealership from car_sales;
- Cselect src:Dealership from car_sales;
- Dselect dealership from car_sales;
How the community answered
(26 responses)- A4% (1)
- B92% (24)
- D4% (1)
Explanation
In Snowflake, VARIANT columns support dot notation to navigate JSON fields: SELECT src.dealership FROM car_sales; (B). Snowflake also supports colon notation (src:dealership), but between the given options, B uses the correct dot notation with matching case. Option A (src:dealership) uses colon notation with lowercase, which could be incorrect if the JSON key is capitalized. Option C (src:Dealership) uses colon notation but assumes a capitalized key. Since JSON key lookups in Snowflake VARIANT are case-sensitive, the case must exactly match the stored key. Option D omits the column reference entirely, which is invalid SQL syntax for accessing VARIANT data.
Topics
Community Discussion
No community discussion yet for this question.
