Courseiva
Data Transformation →hardMultiple Choice

DEA-C02 Data Transformation Practice Question

A data engineer is designing a transformation that requires unpivoting a wide table with columns `q1_sales`, `q2_sales`, `q3_sales`, and `q4_sales` into a long format with columns `quarter` and `sales`. The table has millions of rows. Which Snowflake construct should be used to achieve this efficiently?

⚠ Common exam trap

Watch out — candidates often confuse PIVOT and UNPIVOT, or assuming that manual UNION ALL is the only way to unpivot.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Use the `UNPIVOT` clause in a SELECT statement.

The UNPIVOT clause is specifically designed to transform columns into rows. It is a native Snowflake feature that is optimized for performance on large tables. Using UNION ALL or LATERAL FLATTEN can achieve similar results but with more complexity and potentially less efficiency. PIVOT does the reverse and is not appropriate here.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Use the `PIVOT` clause in a SELECT statement.

    Why it's wrong here

    PIVOT performs the opposite transformation: it rotates rows into columns. Using PIVOT would not unpivot the wide table; it would aggregate and pivot data further, which is not the desired outcome. The engineer needs to convert columns to rows, so PIVOT is incorrect.

  • ✗

    Use a `LATERAL FLATTEN` on an array constructed from the quarter columns.

    Why it's wrong here

    LATERAL FLATTEN is designed for semi-structured data, such as arrays or VARIANT. Constructing an array from the quarter columns and then flattening it would require additional steps and may not be as efficient or straightforward as using the native UNPIVOT clause for relational data.

  • ✓

    Use the `UNPIVOT` clause in a SELECT statement.

    Why this is correct

    UNPIVOT is a built-in Snowflake clause that rotates columns into rows. It is optimized for this operation and can handle millions of rows efficiently. By specifying the columns to unpivot and the output column names, the engineer can transform the wide table into a long format in a single statement.

  • ✗

    Use a series of `UNION ALL` SELECT statements, one for each quarter column.

    Why it's wrong here

    While UNION ALL can achieve unpivoting, it requires multiple scans of the table and concatenation of results. For millions of rows, this is less efficient than the native UNPIVOT clause, which is optimized internally. UNION ALL also increases code complexity and maintenance overhead.

About these practice questions

One of 229 original DEA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Snowflake exam blueprint

This DEA-C02 practice question is part of Courseiva's free Snowflake certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DEA-C02 exam.