+ 3
still confused which are inner join and which one are outer.
4 Réponses
+ 5
in inner join result is where two table match with each other but in case of outer join, result is all data from left or right table with matching data from right or left table.
+ 4
hi, in case of outer join, the values of outer table which matches with the inner table is returned and for the non matching columns Null is returned.
consider a table employee.
empid deptno
123 1
456 2
consider a table department.
deptno deptname
1 HR
3 Finance
select emp.empid, dept.deptname
from employee as emp -- this is inner table
left outer join department as dept -- this is outer table
on emp.deptno= dept.deptno
result would be
empid deptname
123 HR
456 Null
this join returns all values of inner table and only matching values of outer table. if no match is found then null is returned.
Happy learning!
+ 2
if you are aware of set theory then,
inner join of set A and B = A intersect B
outer join of A and B = A + B - 2(A intersect B)
+ 1
Thanks for reply Rinkesh Bhai. Just one small query again. in case of outer join if I reduces 2(A intersect B) in that case it will exclude those element which are common in both A and B. Is my interpretation correct now? Anyway thanks again for giving clarity nd help.