QuestionQ185

VerifiedRestricting and sorting data

Examine the data in the PRODUCTS table:

Question Image

Examine the following queries:

Question Image

Which queries produce the same output?

Explanation

NOT IN (10, 20) is equivalent to being not equal to every value in the list, so it selects only prod_list value 30. The <> ALL (10, 20) condition likewise requires inequality with both 10 and 20, producing the same two rows. In contrast, <> ANY (10, 20) requires inequality with at least one list member, which is true for 10, 20, and 30. Oracle documents NOT IN as equivalent to != ALL, while ANY succeeds if at least one comparison is true and ALL requires every comparison to be true.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!