GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL Plus
Go To First  |  Previous Question  |  Next Question 
 SQL Plus  |  Question 7 of 132    Print  
What is correlated sub-query

  
Total Answers and Comments: 3 Last Update: December 13, 2006   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Aalishan Moosavi
 
A correlated sub-query is a subquery that references the value/s from the main query. 
example :  
SELECT colA 
, colB  
FROM tableA 
WHERE colB < ( SELECT max(colX)  
FROM tableB 
WHERE tableB.colY = tableA.colA) 
Oracle executes correlated subquery for each record from of main query .. hence these types of queries have greater impact on performance and must be avoided

Above answer was rated as good by the following members:
premramana
June 30, 2005 15:25:01   #1  
Aalishan Moosavi        

RE: What is correlated sub-query
A correlated sub-query is a subquery that references the value/s from the main query.
example :
SELECT colA
colB
FROM tableA
WHERE colB < ( SELECT max(colX)
FROM tableB
WHERE tableB.colY tableA.colA)
Oracle executes correlated subquery for each record from of main query .. hence these types of queries have greater impact on performance and must be avoided

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
December 07, 2006 09:41:07   #2  
rampratap409 Member Since: September 2006   Contribution: 111    

RE: What is correlated sub-query

when a sub query executes for each row its called a corelated sub query in other words when a sub query takes the input from outer query for executation then execute and passes the result to outer query then outer query executes.


 
Is this answer useful? Yes | No
December 13, 2006 17:17:28   #3  
sravan1 Member Since: September 2006   Contribution: 10    

RE: What is correlated sub-query

In correlated subqueries the information from the outer select statement participates as a condition in the inner select statement.

Eg : Select deptno ename sal

from emp a

where sal> (select avg(sal) from emp b where a.deptno b.deptno)

order by deptno;


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape