Difficulty: Easy
Correct Answer: Incorrect — NOT EXISTS is true only when the subquery returns no rows
Explanation:
Introduction / Context:
EXISTS and NOT EXISTS are common SQL predicates used to test the presence or absence of rows from a subquery. Understanding their truth conditions is essential for accurate filtering.
Given Data / Assumptions:
Concept / Approach:
NOT EXISTS is logically equivalent to “no rows returned by the subquery.” If the subquery produces even a single row, EXISTS evaluates to true and NOT EXISTS evaluates to false. This holds for both correlated and uncorrelated subqueries; correlation only affects how the subquery is parameterized, not the predicate’s definition.
Step-by-Step Solution:
Define semantics: EXISTS → at least one row, NOT EXISTS → zero rows.Examine the statement’s claim that “any row makes NOT EXISTS true.”Recognize the claim contradicts the definition.Conclude the statement is inaccurate (NOT EXISTS is true only when no rows are returned).
Verification / Alternative check:
Test with a tiny table. If the subquery SELECT 1 FROM dual (or any table) returns a row, EXISTS is true and NOT EXISTS is false; if it returns none, NOT EXISTS is true.
Why Other Options Are Wrong:
Correlation and GROUP BY do not alter the boolean meaning of NOT EXISTS; they only influence the subquery’s result set.
Common Pitfalls:
Confusing NOT EXISTS with NOT IN; NULL handling can make NOT IN tricky, whereas NOT EXISTS is robust to NULLs.
Final Answer:
Incorrect — NOT EXISTS is true only when the subquery returns no rows.
Discussion & Comments