nerdexam
Snowflake

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…

Data Transformations

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)
  • A
    2% (1)
  • B
    4% (2)
  • C
    5% (3)
  • D
    89% (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

#OBJECT_CONSTRUCT#VARIANT Data Type#Semi-structured Data#Data Transformation

Community Discussion

No community discussion yet for this question.

Full COF-C02 Practice