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 name, NTILE(5) OVER (PARTITION salary ORDER BY name) AS group_num FROM staff;

APARTITION BY keyword is missing
BNTILE cannot be used with PARTITION BY
CORDER BY should come before PARTITION BY
DNTILE requires a GROUP BY clause
Step-by-Step Solution
Solution:
  1. Step 1: Review PARTITION BY syntax

    PARTITION BY must be followed by a column name; keyword BY is required.
  2. Step 2: Identify error in query

    The query uses PARTITION salary instead of PARTITION BY salary, causing syntax error.
  3. Final Answer:

    PARTITION BY keyword is missing -> Option A
  4. Quick Check:

    PARTITION BY requires 'BY' keyword [OK]
Quick Trick: Use PARTITION BY, not PARTITION alone [OK]
Common Mistakes:
  • Omitting BY in PARTITION BY
  • Misordering PARTITION BY and ORDER BY
  • Assuming GROUP BY is needed with NTILE

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes