PDE Preparing and Using Data for Analysis Practice Question
A company wants to use BigQuery's PIVOT operator to transform their sales data. They have a table with columns: 'year', 'quarter', 'revenue'. They want to create a report where each row is a year and each column is a quarter (Q1, Q2, Q3, Q4) showing revenue. Which SQL statement is correct?
⚠ Common exam trap
PDE often tests whether candidates remember that BigQuery PIVOT requires an aggregate function and quoted string literals in the IN list — many candidates pick the option that looks like Oracle/SQL Server PIVOT syntax (ON/USING) or forgets the aggregate entirely.
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
✓
SELECT * FROM sales PIVOT(SUM(revenue) FOR quarter IN ('Q1','Q2','Q3','Q4'))
BigQuery's PIVOT operator requires an aggregate function applied to the value column, followed by FOR <pivot_column> IN (<list of values>). Option A correctly uses SUM(revenue) as the aggregate, FOR quarter to specify the pivot column, and IN ('Q1','Q2','Q3','Q4') with quoted string literals. The remaining columns (year) automatically become the grouping keys, producing one row per year with Q1–Q4 as columns.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
SELECT * FROM sales PIVOT(SUM(revenue) FOR quarter IN ('Q1','Q2','Q3','Q4'))
Why this is correct
PIVOT aggregates revenue with SUM, grouping by the remaining column (year) and spreading quarter values into Q1–Q4 columns, exactly matching the required year-per-row, quarter-per-column report. The IN list supplies the literal quarter values to become column headers, so no explicit GROUP BY is needed.
- ✗
SELECT * FROM sales PIVOT(revenue FOR quarter IN (Q1, Q2, Q3, Q4))
Why it's wrong here
BigQuery's PIVOT syntax requires an aggregate function around the value column, so bare revenue fails to parse; the correct form is PIVOT(SUM(revenue) FOR quarter IN (...)). It tempts because PIVOT genuinely reshapes rows into columns, which is exactly the year-by-quarter report required once aggregation is included.
- ✗
PIVOT sales ON quarter USING SUM(revenue)
Why it's wrong here
BigQuery has no PIVOT...ON...USING syntax; PIVOT is a clause appended to a FROM subquery, so this statement fails to parse. It is tempting because it resembles spreadsheet or T-SQL pivot shorthand, but BigQuery requires PIVOT(SUM(revenue) FOR quarter IN (Q1, Q2, Q3, Q4)) after a subquery.
- ✗
SELECT * FROM (SELECT year, quarter, revenue FROM sales) PIVOT(SUM(revenue) FOR quarter IN (Q1, Q2, Q3, Q4))
Why it's wrong here
The syntax is valid BigQuery PIVOT: the subquery supplies year, quarter and revenue, and SUM aggregates revenue into Q1–Q4 columns grouped by year. This is the correct statement, so it is not an incorrect option; the other options misuse the PIVOT clause or omit the required subquery.
About these practice questions
This PDE question is part of Courseiva's 747-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
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 Google Cloud exam blueprint
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.