Skip to content
  • SiteMap
  • Our Services
  • Frequently Asked Questions (FAQ)
  • Support
  • About Us

UpdateGadh

Update Your Skills.

  • Home
  • Projects
    •  Blockchain projects
    • Python Project
    • Data Science
    •  Ai projects
    • Machine Learning
    • PHP Project
    • React Projects
    • Java Project
    • SpringBoot
    • JSP Projects
    • Java Script Projects
    • Code Snippet
    • Free Projects
  • Tutorials
    • Ai
    • Machine Learning
    • Advance Python
    • Advance SQL
    • DBMS Tutorial
    • Data Analyst
    • Deep Learning Tutorial
    • Data Science
    • Nodejs Tutorial
  • Blog
  • Contact us
  • Toggle search form
SQL OUTER JOIN

SQL OUTER JOIN: A Comprehensive Guide

Posted on March 13, 2025March 14, 2025 By Rishabh saini No Comments on SQL OUTER JOIN: A Comprehensive Guide

SQL OUTER JOIN

All of the data from both tables is combined in SQL using the OUTER JOIN. Whether the records from both tables match or not, the result includes both matching and non-matching records. Three kinds of outside joins are supported by SQL:

  • Left Outer Join
  • Right Outer Join
  • Full Outer Join

We shall examine several kinds of outer joins in this guide using examples from MySQL.

Complete Python Course with Advance topics:-Click Here
SQL Tutorial :-Click Here

Understanding Outer Joins with Sample Tables

We have example data in the following tables:

Table 1: Employee

EmployeeIDEmployee_NameEmployee_Salary
1Arun Tiwari50000
2Sachin Rathi64000
3Harshal Pathak48000
4Arjun Kuwar46000
5Sarthak Gada62000
6Saurabh Sheik53000
7Shubham Singh29000
8Shivam Dixit54000
9Vicky Gujral39000
10Vijay Bose28000

Table 2: Department

DepartmentIDDepartment_NameEmployee_ID
1Production1
2Sales3
3Marketing4
4Accounts5
5Development7
6HR9
7Sales10

Table 3: Loan

LoanIDBranchAmount
1B115000
2B210000
3B320000
4B4100000
5B5150000
6B650000
7B735000
8B885000

Table 4: Borrower

CustIDCustNameLoanID
1Sonakshi Dixit1
2Shital Garg4
3Swara Joshi5
4Isha Deshmukh2
5Swati Bose7
6Asha Kapoor10
7Nandini Shah9

1. Left Outer Join

Only matched records from the right table are retrieved by a left outer join, which retrieves all records from the left table. NULL values are returned in the event that no match is discovered.

Syntax:

SELECT Table1.columnName1, Table2.columnName2
FROM Table1
LEFT OUTER JOIN Table2
ON Table1.ColumnName = Table2.ColumnName;

Example 1: Employee and Department Tables

SELECT e.EmployeeID, e.Employee_Name, e.Employee_Salary, d.DepartmentID, d.Department_Name
FROM employee e
LEFT OUTER JOIN department d
ON e.EmployeeID = d.Employee_ID;

Example 2: Loan and Borrower Tables

SELECT l.LoanID, l.Branch, l.Amount, b.CustID, b.CustName
FROM Loan l
LEFT OUTER JOIN Borrower b
ON l.LoanID = b.LoanID;

2. Right Outer Join

Only matched records from the left table are retrieved by a right outer join, which retrieves all entries from the right table. NULL values are returned in the event that no match is discovered.

Syntax:

SELECT Table1.columnName1, Table2.columnName2
FROM Table1
RIGHT OUTER JOIN Table2
ON Table1.ColumnName = Table2.ColumnName;

Example 1: Employee and Department Tables

SELECT e.EmployeeID, e.Employee_Name, e.Employee_Salary, d.DepartmentID, d.Department_Name
FROM employee e
RIGHT OUTER JOIN department d
ON e.EmployeeID = d.Employee_ID;

Example 2: Loan and Borrower Tables

SELECT l.LoanID, l.Branch, l.Amount, b.CustID, b.CustName
FROM Loan l
RIGHT OUTER JOIN Borrower b
ON l.LoanID = b.LoanID;

3. Full Outer Join

All records, matching and non-matching, are retrieved from both tables using a full outer join. Although FULL OUTER JOIN is not natively supported by MySQL, it can be accomplished with UNION.

Workaround for FULL OUTER JOIN in MySQL:

SELECT Table1.columnName1, Table2.columnName2
FROM Table1
LEFT OUTER JOIN Table2
ON Table1.ColumnName = Table2.ColumnName
UNION
SELECT Table1.columnName1, Table2.columnName2
FROM Table1
RIGHT OUTER JOIN Table2
ON Table1.ColumnName = Table2.ColumnName;

Download New Real Time Projects :-Click here
Complete Advance AI topics:- CLICK HERE

Conclusion

SQL OUTER JOINs facilitate the retrieval of data, including unmatched records, from several tables. Database administration requires an understanding of Left Outer Join, Right Outer Join, and workarounds for Full Outer Join in MySQL.

Would you like to explore more SQL queries? Let us know in the comments!


sql left outer join
sql outer join
oracle sql outer join
proc sql outer join
my sql outer join
spark sql outer join
pl sql outer join
mysql outer join
sql outer join example
sql full outer join
sql joins
sql join types
right outer join
self join in sql
sql inner join
left outer join

Post Views: 532
SQL Tutorial Tags:algorithms, computer science, data analyst, data analyst career, data analyst job, Data Analytics, Data Science, data structures, database management system, Engineering, gate, how to become a data analyst, iit, joma, joma academia, joma class, jomaclass, mysql course, mysql tutorial for beginners, outer join in sql, Programming, software engineering, sql course, sql join, sql tutorial for beginners, techtud

Post navigation

Previous Post: Understanding SQL JOIN with Examples
Next Post: Understanding SQL LEFT JOIN with Examples

More Related Articles

SQL LEFT JOIN Understanding SQL LEFT JOIN with Examples SQL Tutorial
SQL SELECT UNIQUE and SELECT DISTINCT Understanding SQL SELECT UNIQUE and SELECT DISTINCT SQL Tutorial
SQL UPDATE with JOIN SQL UPDATE with JOIN SQL Tutorial

Leave a Reply Cancel reply

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

You may also like

  1. Understanding the SQL DELETE Statement and Its Variants
  2. SQL Temporary Tables: A Handy Tool for Developers
  3. SQL SELECT TOP Clause: A Comprehensive Guide
  4. SQL ORDER BY LIMIT – Retrieve Specific Rows from a Database
  5. Understanding SQL CROSS JOIN with Examples
  6. IN vs EXISTS in SQL: A Complete Guide

Most Viewed Posts

  1. Top Large Language Models in 2025
  2. Online Shopping System using PHP, MySQL with Free Source Code
  3. login form in php and mysql , Step-by-Step with Free Source Code
  4. Flipkart Clone using PHP And MYSQL Free Source Code
  5. News Portal Project in PHP and MySql Free Source Code
  6. User Login & Registration System Using PHP and MySQL Free Code
  7. Top 10 Final Year Project Ideas in Python
  8. Online Bike Rental Management System Using PHP and MySQL
  9. E learning Website in php with Free source code
  10. E-Commerce Website Project in Java Servlets (JSP)
  • AI
  • ASP.NET
  • Blockchain
  • ChatCPT
  • code Snippets
  • Collage Projects
  • Data Science Project
  • Data Science Tutorial
  • DBMS Tutorial
  • Deep Learning Tutorial
  • Final Year Projects
  • Free Projects
  • How to
  • html
  • Interview Question
  • Java Notes
  • Java Project
  • Java Script Notes
  • JAVASCRIPT
  • Javascript Project
  • JSP JAVA(J2EE)
  • Machine Learning Project
  • Machine Learning Tutorial
  • MySQL Tutorial
  • Node.js Tutorial
  • PHP Project
  • Portfolio
  • Python
  • Python Interview Question
  • Python Projects
  • PythonFreeProject
  • React Free Project
  • React Projects
  • Spring boot
  • SQL Tutorial
  • TOP 10
  • Uncategorized
  • Online Examination System in PHP with Source Code
  • AI Chatbot for College and Hospital
  • Job Portal Web Application in PHP MySQL
  • Online Tutorial Portal Site in PHP MySQL — Full Project with Source Code
  • Online Job Portal System in JSP Servlet MySQL

Most Viewed Posts

  • Top Large Language Models in 2025 (8,612)
  • Online Shopping System using PHP, MySQL with Free Source Code (5,210)
  • login form in php and mysql , Step-by-Step with Free Source Code (4,862)

Copyright © 2026 UpdateGadh.

Powered by PressBook Green WordPress theme