Clarification required while using correlated subqueries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muzu1232004
    New Member
    • Aug 2007
    • 16

    Clarification required while using correlated subqueries

    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.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    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.

    Comment

    • muzu1232004
      New Member
      • Aug 2007
      • 16

      #3
      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.

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        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.

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          Originally posted by muzu1232004
          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 .

          Comment

          Working...