1,216 views
1 votes
1 votes

Hi , I tried to solve it in this way -- inner query returning zero tuples.

So , outer query becomes select * from table1 where not exists null ( i mean no tuple ).

basically , it should give me all the tuples , right ?

I know , i am wrong , please clarify.

 

2 Answers

0 votes
0 votes

inner query select all those record in which t2b is not equal to t1b as < > means not equal ,finally  inner query will select two   record

as aa,bb and outer quer will not select any tuple containg these records i,e aa,bb so it will return only one tuple 

T1A T2B
C CC

so (a) option ans...

0 votes
0 votes
as this a dependent query as u can see one attribute of outer query is used in the condition in inner query. the approach to this type query is.run then like nested loop of i and j.

take the first row of table specified in outer query and app the inner condition on all the rows of table specified by inner query.

so here on first taking aa from t1. and comparing it it aa ( first row of table t2) match so nothing will come.

now compare with second row of t2. bb will come.

so at the end u will have aa,bb,bb,aa in the inner query selection. as there is no distinct keyword , duplicates will not be removed.

now just remove these tupples from the outer quesry. u will get one tupple i.e c cc

option a it is

Related questions

0 votes
0 votes
0 answers
1
Tuhin Dutta asked Dec 15, 2017
411 views
Student tableROLLNONAMEMARKS1MARKS21T50302S70993DNULL10NULLNULL78NULLNULLNULLNULLNULLa) select count(MARKS1) from student;b) select count(*) from student;
1 votes
1 votes
1 answer
2
worst_engineer asked Oct 3, 2015
766 views
The answer given is (b)But  , according to given query , isn't it d) ?
1 votes
1 votes
1 answer
4
Shubhanshu asked Dec 24, 2018
1,313 views
According to me it should be – “Retrieve the names of all students with a lower rank, than all students with age < 18 ”