Bird
0
0

Why does this query cause an error?

medium📝 Debug Q7 of 15
PostgreSQL - Window Functions in PostgreSQL
Why does this query cause an error?
SELECT NTILE(0) OVER (ORDER BY score) FROM scores;
AORDER BY clause is missing
BNTILE argument must be a positive integer greater than zero
CNTILE cannot be used with OVER clause
Dscore column does not exist
Step-by-Step Solution
Solution:
  1. Step 1: Check NTILE argument rules

    NTILE requires a positive integer greater than zero as argument.
  2. Step 2: Analyze given query

    NTILE(0) is invalid because zero is not allowed.
  3. Final Answer:

    NTILE argument must be a positive integer greater than zero -> Option B
  4. Quick Check:

    NTILE argument > 0 [OK]
Quick Trick: NTILE argument must be > 0 to avoid errors [OK]
Common Mistakes:
  • Using zero or negative numbers as NTILE argument
  • Confusing NTILE argument with number of rows

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes