edited by
18,614 views
63 votes
63 votes

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?

  1. $x = 5 \quad not (not (x = 5))$
  2. $x = 5 \quad x > 4$ and $x < 6,$ where $x$ is an integer
  3. $x ≠ 5 \quad not (x = 5)$
  4. none of the above
edited by

4 Answers

Best answer
75 votes
75 votes

Answer is option C.
$${\begin{array}{|c|cc|cc|cc|}\hline\\
\textbf{Value at hand}&    \textbf{Option A}& & \textbf{Option B}& &\textbf{Option C} \\\hline
   6 & \times & \times & \times & \times & \checkmark & \checkmark  \\ \hline  5 & \checkmark & \checkmark & \checkmark & \checkmark &\times & \times  \\ \hline   \text{NULL}& \times & \times & \times & \times &\color{blue} \times & \color{blue}\checkmark  \\ \hline
\end{array}}$$

edited by
35 votes
35 votes
Answer: C

As (null) != 5 gives false.
But, not((null) = 5) gives not(false) gives true.
edited by
33 votes
33 votes
a.null = 5   => false ,    

 not(not(null=5))  = not(not(false)) = not(true) = false

b. null = 5 => false ,

null>4 and null <6 = False and false = false

c.null ≠ 5 => false

not(null= 5)= not (false) = true

∴ option C is not eqivivalent
1 votes
1 votes

According to given question, comparison with NULL value always False, so “x ≠ 5” will be false. “x = 5” will also false and not (x = 5) = not(false) = true.
Hence, these are not equivalent pair. 

ans-C

Answer:

Related questions

57 votes
57 votes
4 answers
2
Kathleen asked Sep 14, 2014
16,207 views
Given relations r(w, x) and s(y, z) the result ofselect distinct w, x from r, s is guaranteed to be same as r, provided.r has no duplicates and s is non-emptyr and s have...
45 votes
45 votes
4 answers
4