Question 285 of 1,000

PCDE Window Frame Clauses Practice Question

This PCDE practice question tests your understanding of define data structures and implement sql for business intelligence. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. A key principle to apply: window Frame Clauses. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A data analyst needs to create a rolling 30-day average of daily revenue. Which window function clause is required?

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

RANGE BETWEEN INTERVAL 30 DAY PRECEDING AND CURRENT ROW

Option B is correct because `RANGE BETWEEN INTERVAL 30 DAY PRECEDING AND CURRENT ROW` ensures that the window frame includes all rows within the past 30 days, regardless of whether there is exactly one row per day. This is the proper approach for a rolling 30-day average when data may have gaps. Option D (`ROWS BETWEEN 29 PRECEDING AND CURRENT ROW`) assumes a fixed number of rows (30 rows), which only works if each day has exactly one row; if days are missing, the time window will be incorrect.

Key principle: Window Frame Clauses

Answer analysis

Option-by-option breakdown

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

  • UNBOUNDED PRECEDING

    Why it's wrong here

    `UNBOUNDED PRECEDING` defines a window from the start of the partition to the current row, not a rolling 30-day window.

  • RANGE BETWEEN INTERVAL 30 DAY PRECEDING AND CURRENT ROW

    Why this is correct

    Correct. `RANGE BETWEEN INTERVAL 30 DAY PRECEDING AND CURRENT ROW` creates a logical window of exactly 30 days, adjusting for gaps or multiple rows per day.

    Related concept

    Window Frame Clauses

  • PARTITION BY month

    Why it's wrong here

    `PARTITION BY month` divides the result set into monthly partitions but does not define a rolling window within each partition.

  • ROWS BETWEEN 29 PRECEDING AND CURRENT ROW

    Why it's wrong here

    Incorrect. `ROWS BETWEEN 29 PRECEDING AND CURRENT ROW` only works if each day has exactly one row; if data is sparse, the time span will exceed or fall short of 30 days.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The key distinction is between `RANGE` (logical, based on date intervals) and `ROWS` (physical, based on number of rows). For a rolling 30-day average, `RANGE` with an interval correctly handles missing days, while `ROWS` fails if data is not perfectly daily.

Detailed technical explanation

How to think about this question

The `ROWS` clause defines a physical offset based on row position, which is deterministic and unaffected by gaps or duplicate dates in the data. In contrast, `RANGE` uses logical ordering based on the `ORDER BY` column values, which can lead to variable-sized windows if dates are not unique. For a rolling 30-day average on daily data, `ROWS BETWEEN 29 PRECEDING AND CURRENT ROW` is the safest choice because it guarantees exactly 30 rows per window, assuming one row per day. A real-world scenario where this matters is when a company has missing days (e.g., weekends or holidays) — `RANGE` would include more than 30 rows to cover 30 calendar days, while `ROWS` stays fixed at 30 rows, which may not align with the intended 30-day period.

KKey Concepts to Remember

  • Window Frame Clauses
  • RANGE BETWEEN
  • ROWS BETWEEN

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Window Frame Clauses

Real-world example

How this comes up in practice

A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Window Frame Clauses Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.

What to study next

Got this wrong? Here's your next step.

Review window Frame Clauses, then practise related PCDE questions on the same topic to reinforce the concept.

Related practice questions

Related PCDE practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Building and Implementing CI/CD Pipelines for a Service practice questions

Practise PCDE questions linked to Building and Implementing CI/CD Pipelines for a Service.

Bootstrapping a Google Cloud Organisation for DevOps practice questions

Practise PCDE questions linked to Bootstrapping a Google Cloud Organisation for DevOps.

Applying Site Reliability Engineering Practices to a Service practice questions

Practise PCDE questions linked to Applying Site Reliability Engineering Practices to a Service.

Implementing Service Monitoring Strategies practice questions

Practise PCDE questions linked to Implementing Service Monitoring Strategies.

Optimising Service Performance practice questions

Practise PCDE questions linked to Optimising Service Performance.

Plan and manage database infrastructure practice questions

Practise PCDE questions linked to Plan and manage database infrastructure.

Define data structures and implement SQL for Business Intelligence practice questions

Practise PCDE questions linked to Define data structures and implement SQL for Business Intelligence.

Design and implement database schemas practice questions

Practise PCDE questions linked to Design and implement database schemas.

Monitor and optimize database performance practice questions

Practise PCDE questions linked to Monitor and optimize database performance.

PCDE fundamentals practice questions

Practise PCDE questions linked to PCDE fundamentals.

PCDE scenario practice questions

Practise PCDE questions linked to PCDE scenario.

PCDE troubleshooting practice questions

Practise PCDE questions linked to PCDE troubleshooting.

Practice this exam

Start a free PCDE practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this PCDE question test?

Define data structures and implement SQL for Business Intelligence — This question tests Define data structures and implement SQL for Business Intelligence — Window Frame Clauses.

What is the correct answer to this question?

The correct answer is: RANGE BETWEEN INTERVAL 30 DAY PRECEDING AND CURRENT ROW — Option B is correct because `RANGE BETWEEN INTERVAL 30 DAY PRECEDING AND CURRENT ROW` ensures that the window frame includes all rows within the past 30 days, regardless of whether there is exactly one row per day. This is the proper approach for a rolling 30-day average when data may have gaps. Option D (`ROWS BETWEEN 29 PRECEDING AND CURRENT ROW`) assumes a fixed number of rows (30 rows), which only works if each day has exactly one row; if days are missing, the time window will be incorrect.

What should I do if I get this PCDE question wrong?

Review window Frame Clauses, then practise related PCDE questions on the same topic to reinforce the concept.

What is the key concept behind this question?

Window Frame Clauses

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More PCDE practice questions

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This PCDE 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 PCDE exam.