Bird
0
0

Find the mistake in this query:

medium📝 Debug Q7 of 15
SQL - Window Functions Fundamentals
Find the mistake in this query:
SELECT ROW_NUMBER() OVER (ORDER BY) AS rn FROM orders;
AROW_NUMBER() cannot be used without PARTITION BY
BORDER BY clause is empty, must specify column(s)
CMissing FROM clause
DROW_NUMBER() cannot be aliased as rn
Step-by-Step Solution
Solution:
  1. Step 1: Check ORDER BY clause inside OVER()

    ORDER BY must specify at least one column or expression to order rows.
  2. Step 2: Identify error

    Empty ORDER BY clause causes syntax error.
  3. Final Answer:

    ORDER BY clause is empty, must specify column(s) -> Option B
  4. Quick Check:

    ORDER BY inside ROW_NUMBER() cannot be empty [OK]
Quick Trick: ORDER BY inside ROW_NUMBER() must list columns [OK]
Common Mistakes:
  • Leaving ORDER BY empty
  • Assuming PARTITION BY is mandatory
  • Confusing aliasing rules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes