1 1 vote 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 1.8k views answer comment Share Follow Print See all 11 Comments 11 11 Comments reply Ashwin Kulkarni commented Jan 10, 2018 reply Follow flag 0 rows, Comparing with NULL will give undefined result. 0 0 replyShare Naveen K Verma commented Jan 10, 2018 reply Follow flag But answer given in the Virtual Gate Test Series is 2 0 0 replyShare Anu007 commented Jan 10, 2018 reply Follow flag 2 is correct output is 2,4 2,3 0 0 replyShare Naveen K Verma commented Jan 10, 2018 reply Follow flag Please explain. 0 0 replyShare Ashwin Kulkarni commented Jan 10, 2018 reply Follow flag 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 0 replyShare Anu007 commented Jan 10, 2018 reply Follow flag yes they exist i wrote (B,A) .. 0 0 replyShare hs_yadav commented Jan 10, 2018 reply Follow flag 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 0 replyShare Ashwin Kulkarni commented Jan 10, 2018 reply Follow flag Any comparison with NULL will give undefined or false? I think undefined 0 0 replyShare hs_yadav commented Jan 10, 2018 reply Follow flag 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 0 replyShare Ashwin Kulkarni commented Jan 10, 2018 reply Follow flag Then NOT exist (undefined) will not return any rows 0 0 replyShare sai charan chakrala commented Feb 6, 2019 reply Follow flag 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 0 replyShare Please log in or register to add a comment.
0 0 votes there is a mistake in parathezisation...it will be 2 DeadMann answered Oct 30, 2022 DeadMann comment Share Follow 0 reply Please log in or register to add a comment.