in Databases edited by
18,634 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
in Databases edited by
18.6k views

4 Comments

finally I have understood this question !!!
1
1
We can take any value and compare this each expression given in option .
0
0
in this question = is equivalent to assignment operator

and this == is comparision based operator
0
0

4 Answers

75 votes
75 votes
Best answer

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

4 Comments

vijaycs

why are we taking here x=NULL?

1
1
We’re taking x as a numeric attribute here and which can also be null. I think.
0
0

@mani312 that's generally the case. But in the given question it is said to consider a two logic system by considering comparison with null is false. 

1
1
35 votes
35 votes
Answer: C

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

3 Comments

option (b)
NULL=5   False
x>4 and x<6 where x is an integer
Please explain how this evaluates to false
0
0
in all the options, will be evaluating the pair of equations with same value of x(whether it is null or an integer) in option 'b' x is always an integer, so whatever value of x u put both x=5 and x>4 and x<6 will always give the same answer
5
5
Yes. THANKS
0
0
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 vote
1 vote

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