The Left Outer Join

Last updated 24 Oct 2015 . 3 min read



https://img.sheroes.in/img/default_img.jpg https://img.sheroes.in/img/default_img.jpg

Read the first article in this series here

The visual reprsentation of the Left Outer Join is as shown in picture 1. In picture 1  a represents CUSTOMERS table and b represents TRANSACTION table.

A simple query would be like this

SELECT customers.customer_no, customers.customer_Name, transaction.Time_Stamp

FROM customers

LEFT OUTER JOIN transaction

on customers.Customer.no = transaction.Customer.no

The table designs are revisited .

CUSTOMERS Table

Customer_no

Cust_Name

Mid_Name

Last_Name

Street Name

City

Pincode

Email

TRANSACTION Table

Transaction_no
Customer_no
Amount_no
Amount
desc
Time_stamp
Balance
 

Let us take a look at the records of both the tables .

 

CUSTOMERS Table :

 

Customer _no

Cust_ Name

 

 

 

 

C101

PERRY

 

 

 

 

C102

BEIBER

 

 

 

 

C103

SWIFT

 

 

 

 

C104

BYONCE

 

 

 

 

C105

LADY

 

 

 

 

TRANSACTION

Table:

 

 

 

 

 

 

 

 

Transaction_no

Customer_ no  Time_stamp

 

 

T125437

C102

01/01/2015

 

 

T678975

C103

09/01/2015

 

 

T999567

C105

12/09/2015

 

 

The ouput of the left outer join would be

 

 

 

 

 

 

 

Customer _no

Cust_ Name

Time_stamp

 

 

C101

PERRY

xxx

 

 

C102

BEIBER

01/01/2015

 

 

C103

SWIFT

09/01/2015

 

 

C104

BYONCE

xxx

 

 

C105

LADY

12/09/2015

 

This implies ,the result set of a query that uses left outer join will have all records from table a and those that intersect table a from table b or those that have a matching value in table a for the field on which the left outer join is made ;in this case the customer _no field.

The picture 2 above is the representation of how the result set is arrived at for the query ,using Left Outer Join, in discussion.


kanchana_joins_may_article
Kanchana Selvakumar
Kanchana is a passionate Creative Writer. She has immense interest in visualising technology through creativity. Her creative technical articles are posted at OradbaIndia . She is basically an electronics engineer with 15+ years of Information Technology experience which includes working as a freelancer and remote working. She is also passionate about English Poetry. Poetry including picture poetry can be read P4Poetry .If not in the vast world of software and systems, she likes to be lost in the exciting tiny world of her kids.


Share the Article :

Similar Articles You love
Download App

Get The App

Experience the best of SHEROES - Download the Free Mobile APP Now!