retagged by
634 views

1 Answer

3 votes
3 votes

It is an example of nested query with correlation .Following are the 3 salient features of nested query with correlation :

a) Outer query uses the result of inner query

b) Inner query uses the attributes mentioned in outer query

c) So for each  instance of outer query is used and compared with every tuple resulting in the subquery..So the execution sequence is in zigzag manner.

Such nested queries are used generally with EXISTS , NOT EXISTS clauses..

So in the given query  we see for a given value of A attribute of R which is in outer query , it is compared with every attribute value D of relation S in the inner query(or subquery) ..

So for 1 attribute instance of A , inner query will execute once and then we will have those tuples where A = D is satisfied

So total number of times inner query is executed            = No of values of A(or tuples of R)  

                                                                                  =  10  

                                          

Hence B) should be the correct option. 

edited by

Related questions

1 votes
1 votes
2 answers
2
Purple asked Jan 9, 2017
508 views
Consider the following instances $R.$A1234BNull122The number of tuples returned by the following $\text{SQL query}$ is$?$$>$select $*$ from $R$ as $R_{1}$ where not exist...
1 votes
1 votes
1 answer
3
sh!va asked Jul 15, 2016
802 views
Spot the wrong statement.Subschema is related with external view only.Data dictionary is a tool used exclusively by the database administrator.To define a schema DDL, DML...