General Note: Here we have pulled in the data from a sample database. You can download it from the following link and use it for practicing Click Here For Sample Database

Left outer join does the same work as inner join but has very minor difference. The "left outer join" joins two table and retrieves data from both table like inner join, but if there is no matching data in left table, it will return those left table data also in the result. Just modifying the same inner join query with left outer join.

However, this query will not make any difference. Because both table have same mobile names.


Select m1.mobile_name, price, brand_name, star5 
from 
mobile_sales_details m1 
left outer join
mobile_rating m2 on m1.mobile_name=m2.mobile_name

So we are inserting some data to location table using the insert query. Copy and execute the below two query in your editor.


insert into company_location values(11,'Malasiya')

insert into company_location values(10,'Poland')

Now these two location are added in location table. Now we are writing left outer join for company location table with brand_details. It will return Malasiya and Poland in the result. Because of left outer join, it will return the unmatched data in left table.

If you change the left table to right the result will change.


select t1.location_id,t2.location_id,country_name 
from 
company_location t1 
left outer join 
brand_details t2 
on
t1.location_id=t2.location_id


location_id location_id country_name

----------- ----------- ------------

1           1           Finland    

2           2           United State

2           2           United State

2           2           United State

2           2           United State

2           2           United State

3           3           Taiwan    

3           3           Taiwan    

4           4           France    

5           5           South Korea

6           6           Japan      

7           7           India      

7           7           India      

7           7           India      

7           7           India      

8           8           China      

9           9           Canada    

The two null values represents the concept of left outer join