UnitedHealth Group Interview Question: Tell me in non-technical term... | Glassdoor

Interview Question

SQL Data Analytics Analyst Interview Santa Ana, CA

Tell me in non-technical terms the difference between an

  inner join & outter join? (SQL)

Interview Answer

1 Answer


Diff btwn inner and outer join:
Inner joins/Equi/Simple are both same and purpose in to fetch common rows from 2 or more joining tables.
condition to satify would be each table shud and must have common col to perform inner join.
simple syntax would be :
select t1.col1,t1.col2,t2.col1
from t1,t2
where t1.col=t2.col

On other hand Outer join fetches all col from both tables.regardless both tables have matching col or not
Outer join is further divided in to left,right,full Outer Joins.
Left Outer join:ex T1-employee,T2-dept
This join is used to fetch all col of T1
example for this is to find the employees who are not assigned to any departments
select e.ename,d.dname
from employee e
          depatment d
where e.d_id = d.d_id(+)
select e.ename,d.dname
LEFT outer join dept on e.d_id = d.d_id

Right Outer Join
each row of t2 will appear at-least once non matching row of table in displayed with NULL
use of this query is to find out dept which has no employees assigned and also to get details of each emp assigned to which dept .
select e.ename,d.dname
from employee e
          depatment d
where e.d_id(+) = d.d_id
select e.ename,d.dname
RIGHT outer join dept on e.d_id = d.d_id

FULL Outer join:
combines both effect of right and left outer joins
Allows to see each emp who is in which dept and also each emp who is not part of any dept and each dept which doesnt have emp

Anonymous on Jun 8, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.