GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  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


May 05, 2007 08:26:32 #3
 Tushar   Member Since: Visitor    Total Comments: N/A 

RE: What is difference between Co-related sub query an...
 
When we need distinct with join we use corelated sub query (where exists clause) which works faster than nested sub query
     

 

Back To Question