By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,602 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,602 IT Pros & Developers. It's quick & easy.

Clarification required while using correlated subqueries

P: 16
Can anyone explain me when we use correlated subqueries rather than nested subqueries.
Do all the correlated subqueries can be written in nested subqueries form as well ?
What are the major conditions that apply whenever we write a correlated subquery and why we go for it ?
Please let me know about this as i am not clear which to use when.
Aug 28 '07 #1
Share this Question
Share on Google+
4 Replies


debasisdas
Expert 5K+
P: 8,127
Usually writing a corelated subquery is the last option for sql developers.

It should always be avoided at any cost as it is the slowest as per performance.
Aug 29 '07 #2

P: 16
So is it possible to write the nested subqueries from all the types of correlated subquery ? what are the advantages of writing a correlated subquery ? PLease let me know about this.
Aug 29 '07 #3

amitpatel66
Expert 100+
P: 2,367
CORRELATED SUBQUERIES should be written only in case when the SUB QUERY is dependent on one or more columns of outer query.
The Correlated sub query is executed once for each row of outer query.
Aug 29 '07 #4

debasisdas
Expert 5K+
P: 8,127
So is it possible to write the nested subqueries from all the types of correlated subquery ? what are the advantages of writing a correlated subquery ? PLease let me know about this.
as i have already mentioned correlated subqueries should be the last option,if it is possible to write a nested or any other type of sub-suery ,correlated subqueries must and should be avoided .
Aug 29 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.