correlated subquery in oracle

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lopez
    New Member
    • Mar 2008
    • 6

    correlated subquery in oracle

    hi dere,
    i'm new to oracle..
    can anybody help me with correlated subquery
    thanks in advance.
    regards,
    lopez
    (knowledge is power)
  • Saii
    Recognized Expert New Member
    • Apr 2007
    • 145

    #2
    What exactly are you looking for?

    Comment

    • aswath
      New Member
      • Mar 2008
      • 18

      #3
      Originally posted by Saii
      What exactly are you looking for?
      hi,
      i know what a subquery is... however i have never come across a word called correlated subquery.. can u plz tell me what is that.
      thanks in advance.....

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by aswath
        hi,
        i know what a subquery is... however i have never come across a word called correlated subquery.. can u plz tell me what is that.
        thanks in advance.....
        Correlated Sub-Query is something that gets executed once for each record of outer main query.

        Example:

        [code=oracle]

        SELECT MIN(x.salary) FROM emp x WHERE 2 > (SELECT COUNT(*) FROM emp WHERE salary > x.salary);

        [/code]

        The above code in which the inner sub query is callced correlated because if you check the WHERE condition where I have compared salary with salary column of outer MAIN query table.

        Comment

        • lopez
          New Member
          • Mar 2008
          • 6

          #5
          Originally posted by amitpatel66
          Correlated Sub-Query is something that gets executed once for each record of outer main query.

          Example:

          [code=oracle]

          SELECT MIN(x.salary) FROM emp x WHERE 2 > (SELECT COUNT(*) FROM emp WHERE salary > x.salary);

          [/code]

          The above code in which the inner sub query is callced correlated because if you check the WHERE condition where I have compared salary with salary column of outer MAIN query table.
          got it pal.....
          thanks........

          Comment

          Working...