Monday, September 27, 2010

OUTER JOIN

Three different type of OUTER JOIN

1) LEFT OUTER

  • Return all rows in Left table with matching data in Right table.
  • If the Left table have no matching value in Right table assign null value.

SELECT * FROM Table1 t1 LEFT OUTER JOIN Table2 t2 ON t1.Col1=t2.Col1




2) RIGHT OUTER JOIN


  • Return all rows in Right table with matching data in Left table.
  • If the Right table have no matching value in Left table assign null value.

SELECT * FROM Table1 t1 RIGHT OUTER JOIN Table2 t2 ON t1.Col1=t2.Col1



3)
FULL OUTER JOIN



  • t returns row from either table when the conditions are met
  • and returns null value when there is no match.

No comments:

Post a Comment