In SQL, relations can contain null values, and comparisons with null values are treated as unknown. Suppose all comparisons with a null value are treated as false. Which of the following pairs is not equivalent?
View worked solution
Answer: C
To determine which pair is not equivalent, we must evaluate the expressions under the given condition: all comparisons with a null value are treated as false.
Let us analyze the behavior of each option when is null:
Option A: and
- If is
null:false. - If is not
null: Both expressions naturally yield the same boolean value.
Thus, this pair is equivalent.
Option B: and (where is an integer)
- If is
null:false. - If is an integer and not
null: The only integer satisfying and is . Thus, both expressions evaluate totruewhen , andfalseotherwise.
Thus, this pair is equivalent.
Option C: and
- If is
null:- : Since this is a comparison with a
nullvalue, it evaluates tofalse. - : The inner comparison evaluates to
false. Thus, evaluates totrue.
falseand the other totrue, they are not equivalent. - : Since this is a comparison with a
Thus, this pair is not equivalent.
Free practice · Your answers on this page are not saved.
