PDE Ingesting and Processing the Data Practice Question
You are building a BigQuery table that contains nested and repeated fields (e.g., order with line items). You need to write a query that counts the number of line items per order. Which TWO SQL functions/techniques can you use?
⚠ Common exam trap
Google often tests the distinction between functions that operate on arrays directly (like ARRAY_LENGTH) versus those that require row-level expansion (like UNNEST), and candidates may mistakenly choose window functions or STRUCT-based aggregation that do not directly count array elements.
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
✓
UNNEST with COUNT
UNNEST flattens the repeated line items array into individual rows, allowing COUNT to aggregate the number of line items per order. Option D is correct because ARRAY_LENGTH directly returns the number of elements in the repeated field array, which corresponds to the line item count.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Window function ROW_NUMBER
Why it's wrong here
ROW_NUMBER assigns a sequential number but does not directly count array elements.
- ✓
UNNEST with COUNT
Why this is correct
UNNEST expands the array, then COUNT(*) gives the number of line items per order.
- ✗
STRUCT with aggregation
Why it's wrong here
STRUCT is for grouping fields, not counting array elements.
- ✓
ARRAY_LENGTH
Why this is correct
ARRAY_LENGTH returns the number of elements in the repeated field directly.
- ✗
SELECT * EXCEPT
Why it's wrong here
EXCEPT is for excluding columns, not for counting array elements.
Go deeper
Related to this question
About these practice questions
One of 890 original PDE 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PDE practice question is part of Courseiva's free Google Cloud 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 PDE exam.