Posted inMysql / Mysqli / php

sql full join Example

Today, We want to share with you sql full join.In this post we will show you left outer join in sql, hear for sql join we will give you demo and example for implement.In this post, we will learn about right outer join in sql with an example.

Full Join in SQL – SQL Full Joins

In this tutorial we learn to all about having Examples like as a FULL JOIN, outer join, UNION ALL operator to combine the LEFT JOIN and RIGHT JOIN or many more.

Also Read: SQL multiple joins for beginners with examples

The SQL FULL JOIN syntax

SELECT column-names
  FROM table-name1 FULL JOIN table-name2 
    ON column-name1 = column-name2
 WHERE condition

SQL FULL JOIN Examples

Query: Match all shoppers and suppliers by address

SELECT C.ProfileNm, C.SirNm, C.Address AS ShopperAddress, 
       S.Address AS SupplierAddress, S.OrganizationName
  FROM Shopper C FULL JOIN Supplier S 
    ON C.Address = S.Address
 ORDER BY C.Address, S.Address

SQL full outer join:

SELECT table1.member_id, table1.member_name, table1.hire_date, table2.dept_name
FROM members AS table1 FULL JOIN compartments AS table2
ON table1.dept_id = table2.dept_id ORDER BY member_name;

Using UNION ALL operator to combine the LEFT JOIN and RIGHT JOIN

SELECT table1.member_id, table1.member_name, table1.hire_date, table2.dept_name
FROM members AS table1 LEFT JOIN compartments AS table2
ON table1.dept_id = table2.dept_id
UNION ALL
SELECT table1.member_id, table1.member_name, table1.hire_date, table2.dept_name
FROM members AS table1 RIGHT JOIN compartments AS table2
ON table1.dept_id = table2.dept_id ORDER BY member_name;

I hope you get an idea about sql full join.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype