DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: what is the different between left join and right join instead of an outer join

  1. #1
    Join Date
    Dec 2002
    Location
    Australia
    Posts
    1

    what is the different between left join and right join instead of an outer join

    I want to ask what is the meant be left and right joins

  2. #2
    Join Date
    Aug 2002
    Location
    Atlanta
    Posts
    1,187
    Returns all rows that meet the join criteria and allows for non matching
    rows to be returned on the column to the left of the ‘=’ sign.

    SELECT ename, dname
    FROM emp e
    LEFT OUTER JOIN dept d ON e.deptno = d.deptno
    ORDER BY dname;

    ENAME DNAME
    ---------- --------------
    SMITH ACCOUNTING
    FORD RESEARCH
    ADAMS RESEARCH
    SCOTT RESEARCH
    JONES RESEARCH
    JAMES SALES
    TURNER SALES
    BLAKE SALES
    MARTIN SALES
    WARD SALES
    ALLEN SALES



    RIGHT OUTER JOIN
    Returns all rows that meet the join criteria and allows for non matching
    rows to be returned on the column to the left of the ‘=’ sign.

    SELECT ename, dname
    FROM emp e
    RIGHT OUTER JOIN dept d ON e.deptno = d.deptno
    ORDER BY dname;

    ENAME DNAME
    ---------- --------------
    SMITH ACCOUNTING
    OPERATIONS
    JONES RESEARCH
    SCOTT RESEARCH
    FORD RESEARCH
    ADAMS RESEARCH
    ALLEN SALES
    JAMES SALES
    TURNER SALES
    BLAKE SALES
    MARTIN SALES
    WARD SALES
    I'm stmontgo and I approve of this message

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width