Bird
0
0

Find the mistake in this query:

medium📝 Debug Q7 of 15
PostgreSQL - Window Functions in PostgreSQL
Find the mistake in this query:
SELECT name, DENSE_RANK() OVER ORDER BY score DESC FROM players;
ADENSE_RANK() cannot be used with ORDER BY
BMissing PARTITION BY clause
CORDER BY should be outside the query
DMissing parentheses after OVER
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of window functions

    OVER must be followed by parentheses enclosing ORDER BY clause.
  2. Step 2: Identify syntax error

    Query misses parentheses after OVER, causing syntax error.
  3. Final Answer:

    Missing parentheses after OVER -> Option D
  4. Quick Check:

    OVER() requires parentheses even if empty [OK]
Quick Trick: Always use parentheses after OVER() [OK]
Common Mistakes:
  • Omitting parentheses after OVER
  • Placing ORDER BY outside OVER()
  • Assuming PARTITION BY is mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes