Bird
0
0

Which of the following is the correct syntax to specify a window frame using RANGE BETWEEN from 5 preceding to current row?

easy📝 Syntax Q12 of 15
PostgreSQL - Window Functions in PostgreSQL
Which of the following is the correct syntax to specify a window frame using RANGE BETWEEN from 5 preceding to current row?
ARANGE BETWEEN 5 PRECEDING AND CURRENT ROW
BRANGE BETWEEN CURRENT ROW AND 5 PRECEDING
CROWS BETWEEN 5 PRECEDING AND CURRENT ROW
DROWS BETWEEN CURRENT ROW AND 5 PRECEDING
Step-by-Step Solution
Solution:
  1. Step 1: Recall RANGE BETWEEN syntax

    The syntax is: RANGE BETWEEN AND , where start must be before end logically.
  2. Step 2: Check order of frame boundaries

    5 PRECEDING comes before CURRENT ROW, so 'RANGE BETWEEN 5 PRECEDING AND CURRENT ROW' is correct.
  3. Final Answer:

    RANGE BETWEEN 5 PRECEDING AND CURRENT ROW -> Option A
  4. Quick Check:

    Correct RANGE syntax = RANGE BETWEEN 5 PRECEDING AND CURRENT ROW [OK]
Quick Trick: Frame boundaries go from earlier to later, e.g., 5 PRECEDING to CURRENT ROW [OK]
Common Mistakes:
  • Reversing frame boundaries order
  • Using ROWS syntax with RANGE
  • Omitting BETWEEN keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes