CertKeen

SnowPro Core (COF-C03) · Free practice question 10 of 15

LATERAL FLATTEN on VARIANT arrays

You have a column `event` of type VARIANT containing JSON, including an inner array `event:items`. You need to produce one row per element of that array. Which SQL construct achieves this?

  1. A.`SELECT event:items FROM events;`
  2. B.`SELECT f.value FROM events, LATERAL FLATTEN(input => event:items) f;`
  3. C.`SELECT JSON_EXTRACT(event, 'items[*]') FROM events;`
  4. D.`SELECT event::ARRAY[i] FROM events GROUP BY i;`
Show answer and explanation

Correct answer: B. `SELECT f.value FROM events, LATERAL FLATTEN(input => event:items) f;`

Why: `FLATTEN` is Snowflake's table function that turns array or object members into rows; it's typically used with a `LATERAL` join. Direct extraction (option A) returns the whole array as a value, not exploded rows. The other SQL forms shown do not exist in Snowflake.

More free SnowPro Core (COF-C03) questions