1 votes 1 votes Consider the following instance R. A 1 2 3 4 B Null 1 2 2 The number of tuples returned by the following SQL query is _____________. > select * from R as R1 where not exists (select * from R) where B = R1.A Databases databases sql virtual-gate-test-series + – Naveen K Verma asked Jan 10, 2018 • edited Apr 2, 2019 by Lakshman Bhaiya Naveen K Verma 724 views answer comment Share Follow See all 11 Comments See all 11 11 Comments reply Ashwin Kulkarni commented Jan 10, 2018 reply Follow Share 0 rows, Comparing with NULL will give undefined result. 0 votes 0 votes Naveen K Verma commented Jan 10, 2018 reply Follow Share But answer given in the Virtual Gate Test Series is 2 0 votes 0 votes Anu007 commented Jan 10, 2018 reply Follow Share 2 is correct output is 2,4 2,3 0 votes 0 votes Naveen K Verma commented Jan 10, 2018 reply Follow Share Please explain. 0 votes 0 votes Ashwin Kulkarni commented Jan 10, 2018 reply Follow Share 2,3 and 2,4 is this tuple exist ? I have considered this table by rotating it :p A B 1 null 2 1 3 2 4 2 Now if we check B = R1.A all tuples will present in it then NOT exist never goes true And mistakenly I considered A = R1.B then also comparing with null gives 0 rows. 0 votes 0 votes Anu007 commented Jan 10, 2018 reply Follow Share yes they exist i wrote (B,A) .. 0 votes 0 votes hs_yadav commented Jan 10, 2018 reply Follow Share any comparision with NULL will give false.. for A=1 B=null will give False but 1 will give true and not exists lead to False....similerly for 2,but for 3,4 ...null,1,2,2 all will result false therefor result no touple...and not exits true.... therefor ...it will return two touple.... 0 votes 0 votes Ashwin Kulkarni commented Jan 10, 2018 reply Follow Share Any comparison with NULL will give undefined or false? I think undefined 0 votes 0 votes hs_yadav commented Jan 10, 2018 reply Follow Share yes undefined .... let comparison is like this.... any Number =NULL (here we r not sure about the value of NULL therefor False) Number>NULL(again we r not sure about the value of NULL therefor False) Number<NULL(again we r not sure about the value of NULL therefor False)..... therefor we say that the comparison with NULL gives undefine ... 0 votes 0 votes Ashwin Kulkarni commented Jan 10, 2018 reply Follow Share Then NOT exist (undefined) will not return any rows 0 votes 0 votes sai charan chakrala commented Feb 6, 2019 reply Follow Share I think the answer should be 2 as the two tuples with A as 3 and 4 should be returned as they do not have an equivalent value in B. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes there is a mistake in parathezisation...it will be 2 Psy Duck answered Oct 30, 2022 Psy Duck comment Share Follow See all 0 reply Please log in or register to add a comment.