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? $x = 5 \quad not (not (x = 5))$ $x = 5 \quad x > 4$ and $x < 6,$ where $x$ is an integer $x ≠ 5 \quad not (x = 5)$ none of the above Databases gatecse-2000 databases sql normal + – Kathleen asked Sep 14, 2014 edited Oct 26, 2016 by go_editor Kathleen 18.6k views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments Abhineet Singh commented Nov 24, 2020 reply Follow Share finally I have understood this question !!! 1 votes 1 votes GovindYadav29 commented Dec 24, 2022 reply Follow Share We can take any value and compare this each expression given in option . 0 votes 0 votes Chandrabhan Vishwa 1 commented Feb 14 reply Follow Share in this question = is equivalent to assignment operator and this == is comparision based operator 0 votes 0 votes Please log in or register to add a comment.
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}}$$ amarVashishth answered Dec 23, 2015 edited Apr 15, 2019 by ajaysoni1924 amarVashishth comment Share Follow See all 9 Comments See all 9 9 Comments reply Aayushi Aggarwal commented Sep 11, 2016 reply Follow Share @amarVashishth can oyu please explain me the options given, Like i am not able relate between null and x=5. Where does comparision with null comes in picture? 0 votes 0 votes vijaycs commented Sep 11, 2016 reply Follow Share @Aayushi, I am trying to explain option c. Suppose all comparisons with a null value are treated as false. now see, LHS = x !=5, lets take x=null, => (null) !=5 => false. RHS = not( x = 5) , => not ( null = 5) =>> not (false) =>> true. Now check above solution for other options.. 65 votes 65 votes iita commented Jan 14, 2017 reply Follow Share Can u explain about all options and their correctness, means how are they correct 0 votes 0 votes Cristine commented Dec 10, 2018 reply Follow Share Suppose x=NULL a) NULL=5 is false ; Not(Not(NULL=5) => Not(Not(False)) => Not(true) => false...so they are equivalent. b) NULL=6 is false ; NULL> 4 and NULL<6 is also false so they are also equivalent. 1 votes 1 votes Doraemon commented Apr 8, 2020 reply Follow Share Just to add a point: Comparison with NULL value are in general unknown. But here we are treating it to be false. 3 votes 3 votes mani312 commented Jan 26, 2021 reply Follow Share Does anyone observe this statement comparisons with null values are treated as unknown. And how you are concluding NULL != 5 as False. 1 votes 1 votes Pranavpurkar commented Oct 31, 2021 reply Follow Share vijaycs why are we taking here x=NULL? 1 votes 1 votes Rusty_01 commented Oct 29, 2022 reply Follow Share We’re taking x as a numeric attribute here and which can also be null. I think. 0 votes 0 votes Priyanshu Karmakar commented Nov 4, 2022 reply Follow Share @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 votes 1 votes Please log in or register to add a comment.
35 votes 35 votes Answer: C As (null) != 5 gives false. But, not((null) = 5) gives not(false) gives true. Aravind answered Sep 25, 2014 edited May 19, 2015 by Rajarshi Sarkar Aravind comment Share Follow See all 3 Comments See all 3 3 Comments reply Rupjit Chakraborty commented Oct 11, 2014 reply Follow Share option (b) NULL=5 False x>4 and x<6 where x is an integer Please explain how this evaluates to false 0 votes 0 votes Aravind commented Oct 13, 2014 reply Follow Share 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 votes 5 votes Rupjit Chakraborty commented Nov 6, 2014 reply Follow Share Yes. THANKS 0 votes 0 votes Please log in or register to add a comment.
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 heena singh answered Nov 29, 2017 heena singh comment Share Follow See all 0 reply Please log in or register to add a comment.
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 Shailendra_ answered Nov 10, 2019 Shailendra_ comment Share Follow See all 0 reply Please log in or register to add a comment.