0% found this document useful (0 votes)
28 views1 page

Left Join

The document discusses left outer joins in SQL, including that they retrieve all matching and non-matching records from the left table, the left table is the first table mentioned in the join, and provides an example of joining three tables using left outer joins.

Uploaded by

Amol Adhangale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views1 page

Left Join

The document discusses left outer joins in SQL, including that they retrieve all matching and non-matching records from the left table, the left table is the first table mentioned in the join, and provides an example of joining three tables using left outer joins.

Uploaded by

Amol Adhangale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

What is Left Outer Join ?

The Left Outer Join is used to retrieve all the matching records from both the
tables as well as non-matching records from the left side table. In that case, the
non-matching data will take a null value. The LEFT OUTER JOIN or LEFT JOIN keyword
is used to perform the left join.

The question that should come to your mind is which is the left table and which is
the right table? The answer is, the table which is mentioned to the left of the
LEFT OUTER JOIN keyword is the left table, and the table which is mentioned to the
right of the LEFT OUTER JOIN keyword is the right table.
When do we need to use Left JOIN sql?
If you want to retrieve all the matching rows from both the tables involved in the
join as well as all the non-matching rows from the left side table in the result
set then you need to use Left Join . In that case, the non-matching rows will take
a null value.

Joining three Tables in sql using Left Outer Join:


It is also possible in sql to join more than two tables. Let us see and understand
how to JOIN three tables in sql using Left Outer Join. The following is the syntax
in sql to join three tables using Left Outer Join.

Joining three Tables in sql using Left Outer Join with Examples

Example: Left Joining Employee, Projects, and Address tables


Now, our requirement is to fetch the details of all employees along with the
project name and address if they have. The following SQL Query Left Joining
Employee, Projects, and Address tables to fetch the Employee details along with
their projects and address.

SELECT Employee.EmployeeID, FullName, Technology, Gender, ProjectName, Country,


State, City
FROM Employee
LEFT OUTER JOIN Projects ON Employee.EmployeeID = Projects.EmployeeId
LEFT JOIN Address ON Employee.EmployeeID = Address.EmployeeId;
Once you execute the above SQL query, you will get the following result set. You
can see, here, we get all the employee’s records irrespective of whether they are
having Addresses or assigning with any projects or not.

You might also like