1 votes 1 votes Databases databases sql ace-test-series + – Na462 asked Jan 19, 2019 • edited Mar 3, 2019 by I_am_winner Na462 1.2k views answer comment Share Follow See all 22 Comments See all 22 22 Comments reply kumar.dilip commented Jan 19, 2019 reply Follow Share $0$. NOT IN returns zero when compare with UNKNOWN. 0 votes 0 votes Na462 commented Jan 19, 2019 reply Follow Share Yeah exactly but answer is two : its like T1.A != 'a' and T1.A != 'NULL' and entire will return false right brother ? 0 votes 0 votes imShreyas commented Dec 1, 2019 reply Follow Share @`JEET @techbd123 What do you guys think about this? How to handle NULL values. 2 votes 2 votes `JEET commented Dec 1, 2019 reply Follow Share According to me $\mathbf 0$ should be the answer as we can't compare the NULL value as it is not certain. 0 votes 0 votes `JEET commented Dec 1, 2019 i edited by `JEET Dec 1, 2019 reply Follow Share Some of the interesting cases for comparison: Assume that there are $10$ tuples in a student relation, then the result of the following queries will yield the following output: $\color {blue} {\text{> SELECT * FROM STUDENTS WHERE}}$ $1 = 2 \;\;\; \mathbf{Zero} \;\text{Rows will be selected.}$ $1 < 2 \;\;\; \,\mathbf{All\;rows\;} \;\text{will be selected}.$ $\mathbf{null = 0} \;\;\;\mathbf{Zero\;rows} \;\text{will be selected}.$ $\mathbf{null<>0}\;\;\;\mathbf{zero\;rows}\;\text{will be selected}.$ $\mathbf{null\; =\;\underline{is\;null}}\;\;\;\text{All rows will be selected}.$ 0 votes 0 votes `JEET commented Dec 1, 2019 reply Follow Share @techbd123 Would you like to add anything more? 0 votes 0 votes techbd123 commented Dec 1, 2019 i edited by techbd123 Dec 1, 2019 reply Follow Share I think answer should be $2$ rows. To understand $\text{NOT IN}$, check here. 0 votes 0 votes `JEET commented Dec 1, 2019 reply Follow Share The concept of NOT IN is ok. But you can't compare with null? 0 votes 0 votes `JEET commented Dec 1, 2019 reply Follow Share while searching $\mathbf a$ is ok but searching $\mathbf b$ and $\mathbf c$ you have to compare them with null, which can't be possible. 0 votes 0 votes `JEET commented Dec 1, 2019 reply Follow Share @Satbir Can you look to this question. 0 votes 0 votes `JEET commented Dec 1, 2019 reply Follow Share @Satbir Can you look at this question? 0 votes 0 votes Satbir commented Dec 1, 2019 reply Follow Share empty result since null means unknown value , hence it can't be compared. 2 votes 2 votes `JEET commented Dec 1, 2019 reply Follow Share Right! 0 votes 0 votes techbd123 commented Dec 1, 2019 reply Follow Share Try here with the following statements to understand $\text{NOT IN}$. and 0 votes 0 votes Satbir commented Dec 1, 2019 reply Follow Share @techbd123 There is no NULL cells in the example you provided above. But still it is good to understand IN and NOT IN. 1 votes 1 votes `JEET commented Dec 1, 2019 reply Follow Share @techbd123That is the different thing. that is correct but answer has changed here due to the properties of null. 0 votes 0 votes techbd123 commented Dec 1, 2019 reply Follow Share The SQL can be reduced to SELECT * FROM Table 1 WHERE $\mathrm{T_1A}$ NOT IN ('a', null) Hopefully you can understand the case now. 0 votes 0 votes `JEET commented Dec 2, 2019 reply Follow Share So according to you $2$ is still the answer? @techbd123 0 votes 0 votes techbd123 commented Dec 2, 2019 reply Follow Share Yeah. 0 votes 0 votes `JEET commented Dec 2, 2019 reply Follow Share But according to me its $\mathbf 0$ only. Let's see if someone else come up with different logic. 0 votes 0 votes Gaurav_Singh2 commented Dec 21, 2019 reply Follow Share I have created a similar table and executed the query, According to this answer should be A) 2 rows. 1 votes 1 votes `JEET commented Dec 21, 2019 reply Follow Share I don't know but theoretically it should be 0. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes A 2 When b,c compare with a then it return two tuple Ram Swaroop answered Nov 30, 2019 Ram Swaroop comment Share Follow See all 2 Comments See all 2 2 Comments reply Hradesh patel commented Nov 30, 2019 reply Follow Share @Ram Swaroop how u compare with NULL value???? 1 votes 1 votes Ram Swaroop commented Dec 1, 2019 reply Follow Share @Hradesh patel No we can't compare with null value But comparison can only be done with a that return 2 row 1 votes 1 votes Please log in or register to add a comment.