Bird
0
0

Identify the error in this query:

medium📝 Debug Q14 of 15
SQL - Window Functions Fundamentals
Identify the error in this query:
SELECT id, RANK() OVER ORDER BY score FROM players;
AMissing parentheses after OVER and ORDER BY inside them.
BRANK() cannot be used with OVER clause.
CORDER BY should be outside the OVER clause.
DThe query is correct and will run without errors.
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of RANK() with OVER

    RANK() requires OVER() with parentheses enclosing ORDER BY clause.
  2. Step 2: Identify missing parentheses

    The query misses parentheses after OVER and does not put ORDER BY inside them, causing syntax error.
  3. Final Answer:

    Missing parentheses after OVER and ORDER BY inside them. -> Option A
  4. Quick Check:

    OVER() must have parentheses with ORDER BY inside [OK]
Quick Trick: Always use OVER(...) with parentheses enclosing ORDER BY [OK]
Common Mistakes:
  • Writing OVER without parentheses
  • Placing ORDER BY outside OVER()
  • Assuming RANK() works without OVER

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes