Bird
0
0

Which of the following is the correct syntax to define a named window called w1 that orders rows by date ascending?

easy📝 Syntax Q12 of 15
PostgreSQL - Window Functions in PostgreSQL
Which of the following is the correct syntax to define a named window called w1 that orders rows by date ascending?
AWINDOW w1 (ORDER BY date ASC)
BWINDOW w1 AS (ORDER BY date ASC)
CWINDOW w1 BY (ORDER date ASC)
DWINDOW AS w1 ORDER BY date ASC
Step-by-Step Solution
Solution:
  1. Step 1: Recall WINDOW clause syntax

    The correct syntax is WINDOW name AS (window_definition), e.g., WINDOW w1 AS (ORDER BY date ASC).
  2. Step 2: Check each option's syntax

    WINDOW w1 AS (ORDER BY date ASC) matches correct syntax. Options A, B, and D have incorrect keyword order or missing AS.
  3. Final Answer:

    WINDOW w1 AS (ORDER BY date ASC) -> Option B
  4. Quick Check:

    WINDOW name AS (definition) syntax [OK]
Quick Trick: Use WINDOW name AS (definition) syntax [OK]
Common Mistakes:
  • Omitting AS keyword
  • Using BY instead of ORDER BY
  • Misplacing parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes