Results 1 to 4 of 4

Thread: difference between self join and correlated queries

  1. #1
    Junior Member
    Join Date
    Mar 2008
    Answers
    1

    difference between self join and correlated queries

    difference between self join and correlated queries


  2. #2
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: difference between self join and correlated queries

    Joining a table to itself is known as selft join. The self join can be viewed as a join of two copies of the same table.

    SELECT e1.last_name||' works for '||e2.last_name
    "Employees and Their Managers"
    FROM employees e1, employees e2
    WHERE e1.manager_id = e2.employee_id
    AND e1.last_name LIKE 'R%';


    Correlated queries are subqueries in which inner query is evaluated once per each row processed by the outer query. They take more processing time.


    A correlated subquery can return the same result as a self join, but can be used where a join cannot, such as in an UPDATE, INSERT and DELETE statement.

    Last edited by krishnaindia2007; 04-05-2008 at 12:05 AM.

  3. #3
    Contributing Member
    Join Date
    Apr 2008
    Answers
    31

    Re: difference between self join and correlated queries

    Self join is joining the one table to itself, but when you come to the corealted queries we can use the different tables and in the corelated queries the inner query executes first, but it will dependa on the outer query. so they are interrelated to each other.


  4. #4
    Junior Member
    Join Date
    Jul 2008
    Answers
    1

    Smile Re: difference between self join and correlated queries

    self join is done from a single table like if u wana find out the employee id of a manager then we do self join with the table in this only a single table is rquired

    where as in coreleted sub query the result is based on the outer query like every time the inner query is exicuted the outer query is executed and the data can be retervied from two tables in subquery we can have difrnt table and vice versa.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact