Bird
0
0

Why does a window function not reduce the number of rows returned, unlike GROUP BY?

hard📝 Conceptual Q10 of 15
SQL - Window Functions Fundamentals
Why does a window function not reduce the number of rows returned, unlike GROUP BY?
ABecause window functions automatically remove duplicates.
BBecause window functions only work on indexed columns.
CBecause window functions require a HAVING clause.
DBecause window functions compute values across rows but keep each original row intact.
Step-by-Step Solution
Solution:
  1. Step 1: Understand window function behavior

    Window functions calculate aggregates or rankings over a set of rows but do not group or collapse rows.
  2. Step 2: Contrast with GROUP BY

    GROUP BY aggregates rows into groups, reducing the number of rows returned.
  3. Final Answer:

    Because window functions compute values across rows but keep each original row intact. -> Option D
  4. Quick Check:

    Window functions keep rows; GROUP BY reduces rows = C [OK]
Quick Trick: Window functions keep rows; GROUP BY collapses them [OK]
Common Mistakes:
  • Thinking window functions remove duplicates
  • Assuming window functions require HAVING
  • Believing window functions only work on indexes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes