Difficulty: Easy
Correct Answer: Incorrect
Explanation:
Introduction / Context:The WHERE clause filters rows before projection and grouping. This question checks whether WHERE can express complex conditions or is limited to a single value test.
Given Data / Assumptions:
Concept / Approach:WHERE is fully expressive for row filtering: WHERE (status IN ('NEW','PENDING')) AND (amount > 100) AND (region = 'EMEA'). It can compare column-to-column, column-to-expression, and even include scalar subqueries. It is not restricted to a single value comparison. WHERE applies before GROUP BY; HAVING filters groups after aggregation.
Step-by-Step Solution:
List all business rules to filter rows.Translate each rule into a predicate.Combine predicates with AND/OR, and use parentheses for clarity.Use IN/EXISTS for set logic and subqueries when needed.Verification / Alternative check:Compare counts when applying individual predicates versus the full combined WHERE to ensure logic matches requirements.
Why Other Options Are Wrong:
Common Pitfalls:Ambiguous logic from missing parentheses, and confusing WHERE vs. HAVING. Always test boundary conditions and NULL handling.
Final Answer:Incorrect
Discussion & Comments