Bird
0
0

What will be the output bucket for the lowest value when using NTILE(2) on a table with values 10, 20, 30, 40?

medium📝 query result Q5 of 15
PostgreSQL - Window Functions in PostgreSQL
What will be the output bucket for the lowest value when using NTILE(2) on a table with values 10, 20, 30, 40?
A3
B2
C1
D4
Step-by-Step Solution
Solution:
  1. Step 1: Order values and split into 2 buckets

    4 rows split into 2 buckets of 2 rows each: first bucket has 10 and 20.
  2. Step 2: Identify bucket for lowest value

    Lowest value 10 is in the first bucket.
  3. Final Answer:

    1 -> Option C
  4. Quick Check:

    Lowest values go to first NTILE bucket [OK]
Quick Trick: Lowest values always in bucket 1 with NTILE [OK]
Common Mistakes:
  • Assigning lowest value to last bucket
  • Confusing bucket numbers with values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes