nerdexam
SnowflakeSnowflake

DEA-C02 · Question #20

DEA-C02 Question #20: Real Exam Question with Answer & Explanation

The correct answer is B: When TABLE with FLATTEN requires no additional source in the FROM clause to refer to.. Option B is correct because TABLE(FLATTEN(...)) is self-contained - it can operate on a literal array or a value that doesn't depend on referencing a separate table source in the FROM clause. When no cross-reference to another FROM clause source is needed, TABLE(FLATTEN(...)) is

Data Transformation

Question

When would a Data Engineer use TABLE with the FLATTEN function instead of the LATERAL FLATTEN combination?

Options

  • AWhen TABLE with FLATTEN requires another source in the FROM clause to refer to.
  • BWhen TABLE with FLATTEN requires no additional source in the FROM clause to refer to.
  • CWhen the LATERAL FLATTEN combination requires no other source in the FROM clause to refer
  • DWhen TABLE with FLATTEN is acting like a sub-query executed for each returned row.

Explanation

Option B is correct because TABLE(FLATTEN(...)) is self-contained - it can operate on a literal array or a value that doesn't depend on referencing a separate table source in the FROM clause. When no cross-reference to another FROM clause source is needed, TABLE(FLATTEN(...)) is sufficient on its own.

Why the distractors are wrong:

  • A inverts the logic - needing another source to reference is exactly when you'd reach for LATERAL FLATTEN, not TABLE(FLATTEN(...)).
  • C has it backwards - LATERAL FLATTEN is used precisely because it needs to reference another source; LATERAL exists to allow that correlated reference.
  • D describes the behavior of LATERAL, not TABLE(FLATTEN()) - acting like a correlated subquery executed per row is the defining characteristic of LATERAL.

Memory tip: Think of LATERAL as "looking sideways" at another table already in your FROM clause. If you need to look sideways at another source, use LATERAL FLATTEN. If your array is self-contained and needs no sideways glance, TABLE(FLATTEN(...)) alone is enough.

Topics

#Snowflake FLATTEN#Semi-structured data#Lateral vs Table function#JSON and Array processing

Community Discussion

No community discussion yet for this question.

Full DEA-C02 PracticeBrowse All DEA-C02 Questions