Bird
Raised Fist0

Why does the WHERE clause filter out rows before grouping when used with GROUP BY?

hard🧠 Conceptual Q10 of Q15
C Sharp (C#) - LINQ Fundamentals

Why does the WHERE clause filter out rows before grouping when used with GROUP BY?

ABecause WHERE is ignored when GROUP BY is used
BBecause WHERE filters rows before aggregation, affecting which rows are grouped
CBecause WHERE filters after grouping, so it affects groups directly
DBecause WHERE only filters columns, not rows
Step-by-Step Solution
Solution:
  1. Step 1: Understand WHERE and GROUP BY order

    WHERE filters rows before aggregation and grouping happens.
  2. Step 2: Clarify effect on grouping

    Filtering before grouping changes which rows are included in groups; HAVING filters after grouping.
  3. Final Answer:

    Because WHERE filters rows before aggregation, affecting which rows are grouped -> Option B
  4. Quick Check:

    WHERE filters before GROUP BY [OK]
Quick Trick: WHERE filters rows before grouping; HAVING filters groups [OK]
Common Mistakes:
MISTAKES
  • Thinking WHERE filters after grouping
  • Ignoring WHERE with GROUP BY
  • Confusing WHERE with HAVING

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes