| |
GeekInterview.com > Interview Questions > Database > SQL
| Print | |
Question: What is difference between Co-related sub query and nested sub query?
Answer: Co-related sub query is one in which inner query is evaluated only once and from that result outer query is evaluated.
Nested query is one in which Inner query is evaluated for multiple times for gatting one row of that outer query.
ex. Query used with IN() clause is Co-related query. Query used with = operator is Nested query |
| July 07, 2007 19:59:42 |
#4 |
| rangunagaraj |
Member Since: February 2007 Total Comments: 5 |
RE: What is difference between Co-related sub query an... |
| If the evaluation of an inner querry(a sub querry) depends on a variable which gets its value in an outer querry,such a subquerry has to be evaluated for each value of the variable.Such a querry is a correlated subquerry.If no such variable is used,the subquerry needs to be evaluated only once for the entire querry,and is called a non-correlated subquerry. |
| |
Back To Question | |