Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
SnowPro Core Certification · Snowflake
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
Why Option B is correct: The FLATTEN function is a table function specifically designed to unpack and explode nested, semi-structured data types (such as VARIANT, OBJECT, or ARRAY) into separate lateral rows. It converts hierarchical data (like JSON or XML) into a relational format.
* Why is FLATTEN also used in Structured Types? : Because Snowflake's Structured Types (structured data) have internally nested complex structures, they are difficult to query directly using general SQL queries. : At this time, the FLATTEN function performs the following roles: - Convert nested structures into table form for easy search. - Internal composite elements (STRUCTURED ARRAY, STRUCTURED OBJECT, MAP internal elements) are expanded into separate rows to enable querying. In other words, the FLATTEN function is essential in Snowflake's Structured Types (explicitly structured complex data), not general table data.
there are 2 reason in snowflake document. 1) https://docs.snowflake.com/en/sql-reference/data-types-structured#label-structured-types-working-flatten --> Using the FLATTEN function with values of structured types --> You can pass structured ARRAY, structured OBJECT, and MAP values to the FLATTEN function. As is the case with semi-structured data types, you can use the PATH argument to specify the value being flattened. 2) https://docs.snowflake.com/en/sql-reference/functions/flatten#usage-notes --> FLATTEN is a table function that takes a VARIANT, OBJECT, or ARRAY column and produces a lateral view (i.e. an inline view that contains correlation referring to other tables that precede it in the FROM clause). --> FLATTEN can be used to convert semi-structured data to a relational representation.