Bird
0
0

Identify the error in this query:

medium📝 Debug Q6 of 15
SQL - Window Functions Fundamentals

Identify the error in this query:
SELECT id, NTILE(4) ORDER BY salary FROM employees;

ANTILE cannot be used with numeric columns
BORDER BY cannot be used inside NTILE
CMissing OVER() clause after NTILE(4)
DMissing GROUP BY clause
Step-by-Step Solution
Solution:
  1. Step 1: Check NTILE syntax

    NTILE requires an OVER() clause with ORDER BY inside it.
  2. Step 2: Analyze the query

    The query uses ORDER BY outside OVER(), which is invalid syntax.
  3. Final Answer:

    Missing OVER() clause after NTILE(4) -> Option C
  4. Quick Check:

    NTILE needs OVER() with ORDER BY [OK]
Quick Trick: Always use OVER() with NTILE [OK]
Common Mistakes:
  • Placing ORDER BY outside OVER()
  • Assuming NTILE works without OVER()
  • Confusing NTILE with GROUP BY

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes