COF-C02 · Question #456
Which function is used to convert rows in a relational table to a single VARIANT column?
The correct answer is D. OBJECT_CONSTRUCT. The OBJECT_CONSTRUCT function in Snowflake is used to convert rows in a relational table into a single VARIANT column that represents each row as a JSON object. This function dynamically creates a JSON object from a list of key-value pairs, where each key is a column name and…
Question
Which function is used to convert rows in a relational table to a single VARIANT column?
Options
- AARRAY_AGG
- BOBJECT_AGG
- CARRAY_CONSTRUCT
- DOBJECT_CONSTRUCT
How the community answered
(55 responses)- A2% (1)
- B4% (2)
- C5% (3)
- D89% (49)
Explanation
The OBJECT_CONSTRUCT function in Snowflake is used to convert rows in a relational table into a single VARIANT column that represents each row as a JSON object. This function dynamically creates a JSON object from a list of key-value pairs, where each key is a column name and each value is the corresponding column value for a row. This is particularly useful for aggregating and transforming structured data into semi-structured JSON format for further processing or analysis.
Topics
Community Discussion
No community discussion yet for this question.