Hi,
Can anyone tell me about Outer join with an example ? Also explain types of Outer join in SQL server.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Arul SelvanPosted Aug 3, 2011, 8:41 AM
1.left outer join
2.right outer join
3.full outer join
In normal join compare two table and display rows which match based on condition
but left outer join display all values from left side table and display matched value only right side table
see below example
employee table
department table
see above tables both have depid
left outer join
select employee.empid,employee.empname,department.depid,department.depname from employee left outer join department on employee.depid=department.depid;
now see the left side all values are displayed and right side table which are not match it display NULL
The right outer join opposite to left outer join
The full join both side it display not matched value as NULL
select employee.empid,employee.empname,department.depid,department.depname from employee full outer join department on employee.depid=department.depid;