554 views
1 votes
1 votes

What B=2 return means? How is it returning the tuple? and

How many number of rows return here?

3 Answers

Best answer
3 votes
3 votes

ans is 0 

since b = 2 is not present in table.So inner query retuern empty and outer query select 0 row.

if not exist is use insteed of exist then all 3 row will be select in ans.

selected by
1 votes
1 votes
The inner query will not reurn anything as B=2 is not satisfied in the give table . it would have returned the no of rows with value b=2 which is not the case here.

outer query will again return nothing  (or now selected ) since exixts condition is fasle if inner query would have returned even a single row then outer query would return all the rows present in the table
1 votes
1 votes

@sreshtha.

The inner query here returns 0 (and not NULL) as count(*) always returns some count.

I executed a similar query in MYSQL where the inner query returns 0.

EXISTS(0) is true.

So, select * from T where true

returns all the tuples in the table.

Related questions

2 votes
2 votes
2 answers
1
richa116 asked Nov 29, 2015
349 views
1 votes
1 votes
0 answers
3
1 votes
1 votes
1 answer
4
richa116 asked Nov 29, 2015
298 views