Bird
0
0

What does the ROWS BETWEEN clause specify in a window function?

easy📝 Conceptual Q11 of 15
PostgreSQL - Window Functions in PostgreSQL
What does the ROWS BETWEEN clause specify in a window function?
AIt defines the frame by counting rows relative to the current row position.
BIt defines the frame by counting rows based on the value range in the ORDER BY column.
CIt filters rows before applying the window function.
DIt sorts the rows before applying the window function.
Step-by-Step Solution
Solution:
  1. Step 1: Understand window frame types

    Window frames can be defined by position (ROWS) or by value range (RANGE).
  2. Step 2: Identify what ROWS BETWEEN does

    ROWS BETWEEN counts rows relative to the current row's position, not by values.
  3. Final Answer:

    It defines the frame by counting rows relative to the current row position. -> Option A
  4. Quick Check:

    ROWS BETWEEN = position-based frame [OK]
Quick Trick: ROWS counts rows by position, RANGE counts by value range [OK]
Common Mistakes:
  • Confusing ROWS with RANGE
  • Thinking ROWS filters rows
  • Assuming ROWS sorts data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes