Skip to content
Official PYQ · 2000

GATE CS 2000 Q2.26 — Tuple Calculus and SQL

Explain with AI

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?

Choose one option
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 xx is null:

Option A: x=5x = 5 and not(not(x=5))\text{not}(\text{not}(x = 5))

  • If xx is null:
    • x=5  ⟹  falsex = 5 \implies \text{false}
    • not(not(x=5))  ⟹  not(not(false))  ⟹  not(true)  ⟹  false\text{not}(\text{not}(x = 5)) \implies \text{not}(\text{not}(\text{false})) \implies \text{not}(\text{true}) \implies \text{false}
    Both expressions evaluate to false.
  • If xx is not null: Both expressions naturally yield the same boolean value.

Thus, this pair is equivalent.

Option B: x=5x = 5 and x>4 and x<6x > 4 \text{ and } x < 6 (where xx is an integer)

  • If xx is null:
    • x=5  ⟹  falsex = 5 \implies \text{false}
    • (x>4 and x<6)  ⟹  false and false  ⟹  false(x > 4 \text{ and } x < 6) \implies \text{false and false} \implies \text{false}
    Both expressions evaluate to false.
  • If xx is an integer and not null: The only integer satisfying x>4x > 4 and x<6x < 6 is 55. Thus, both expressions evaluate to true when x=5x = 5, and false otherwise.

Thus, this pair is equivalent.

Option C: x≠5x \neq 5 and not(x=5)\text{not}(x = 5)

  • If xx is null:
    • x≠5x \neq 5: Since this is a comparison with a null value, it evaluates to false.
    • not(x=5)\text{not}(x = 5): The inner comparison x=5x = 5 evaluates to false. Thus, not(false)\text{not}(\text{false}) evaluates to true.
    Since one expression evaluates to false and the other to true, they are not equivalent.

Thus, this pair is not equivalent.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Tuple Calculus and SQL questions