Bird
0
0

Why does NTILE sometimes create groups with different numbers of rows?

hard📝 Conceptual Q10 of 15
SQL - Window Functions Fundamentals

Why does NTILE sometimes create groups with different numbers of rows?

ABecause the total rows may not divide evenly by the number of groups
BBecause NTILE randomly assigns rows to groups
CBecause NTILE ignores the ORDER BY clause
DBecause NTILE requires a GROUP BY clause
Step-by-Step Solution
Solution:
  1. Step 1: Understand NTILE grouping logic

    NTILE divides rows into groups as evenly as possible but leftover rows cause some groups to have one more row.
  2. Step 2: Eliminate incorrect reasons

    NTILE does not assign rows randomly, respects ORDER BY, and does not require GROUP BY.
  3. Final Answer:

    Because the total rows may not divide evenly by the number of groups -> Option A
  4. Quick Check:

    Unequal groups due to leftover rows [OK]
Quick Trick: Unequal groups happen when rows don't divide evenly [OK]
Common Mistakes:
  • Thinking NTILE assigns rows randomly
  • Believing NTILE ignores ordering
  • Assuming GROUP BY is needed for NTILE

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes