Bird
0
0

Which of the following best describes how PARTITION BY affects window function results?

easy📝 Conceptual Q2 of 15
PostgreSQL - Window Functions in PostgreSQL
Which of the following best describes how PARTITION BY affects window function results?
AIt applies the window function only once to the entire table
BIt resets the window function calculation for each partition group
CIt removes duplicate rows from the result set
DIt changes the data type of the window function output
Step-by-Step Solution
Solution:
  1. Step 1: Understand window function behavior with PARTITION BY

    PARTITION BY divides rows into groups; window functions restart calculation for each group.
  2. Step 2: Eliminate incorrect options

    Window functions always run per row; PARTITION BY does not remove duplicates or change data types.
  3. Final Answer:

    It resets the window function calculation for each partition group -> Option B
  4. Quick Check:

    PARTITION BY resets window function per group = true [OK]
Quick Trick: Window functions restart per PARTITION BY group, not once globally [OK]
Common Mistakes:
  • Thinking window functions run once for whole table
  • Confusing PARTITION BY with DISTINCT
  • Assuming PARTITION BY changes output data type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes