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 LEFT JOIN

Understanding SQL LEFT JOIN with Examples

Posted on March 14, 2025March 14, 2025 By Rishabh saini No Comments on Understanding SQL LEFT JOIN with Examples

SQL LEFT JOIN

Multiple tables can be combined into a single result set in SQL using the JOIN method, which is based on a relevant column. Among the various types of joins, the LEFT JOIN is particularly useful when you want to retrieve all records from one table while fetching matching records from another table where available.

Only the matching records from the right table are included when an LEFT JOIN is performed; all data from the left table are returned. In the event that no match is discovered, NULL will appear in the right table’s columns.

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

SQL LEFT JOIN Syntax

The general syntax for performing a LEFT JOIN operation in SQL is:

SELECT Table1.Column1, Table2.Column2
FROM Table1
LEFT JOIN Table2
ON Table1.CommonColumn = Table2.CommonColumn;

Let’s now take a closer look into LEFT JOIN using actual MySQL database samples.

Example 1: Employee and Department Tables

Consider two tables: staff and unit.

Staff Table

StaffIDStaff_NameSalary
101Rahul Sharma70000
102Neha Verma52000
103Manish Yadav48000
104Priya Kapoor45000
105Karan Joshi62000
106Anjali Rathi55000
107Aman Taneja30000
108Simran Kaur58000
109Sahil Arora40000
110Nitin Mehta31000

Unit Table

UnitIDUnit_NameStaff_ID
1HR101
2IT103
3Finance104
4Sales105
5R&D107
6Marketing109
7Support110

Query to Perform LEFT JOIN:

SELECT s.StaffID, s.Staff_Name, s.Salary, u.UnitID, u.Unit_Name
FROM staff s
LEFT JOIN unit u
ON s.StaffID = u.Staff_ID;

Output:

StaffIDStaff_NameSalaryUnitIDUnit_Name
101Rahul Sharma700001HR
102Neha Verma52000NULLNULL
103Manish Yadav480002IT
104Priya Kapoor450003Finance
105Karan Joshi620004Sales
106Anjali Rathi55000NULLNULL
107Aman Taneja300005R&D
108Simran Kaur58000NULLNULL
109Sahil Arora400006Marketing
110Nitin Mehta310007Support

Example 2: Loans and Customers

Consider two tables: credit and client.

Credit Table

LoanIDBranchAmount
1B120000
2B215000
3B350000
4B4120000
5B580000
6B635000

Client Table

ClientIDClient_NameLoanID
1Rohan Kapoor1
2Meera Singh4
3Tanya Verma5
4Rakesh Mehta2

Query to Perform LEFT JOIN:

SELECT c.LoanID, c.Branch, c.Amount, cl.ClientID, cl.Client_Name
FROM credit c
LEFT JOIN client cl
ON c.LoanID = cl.LoanID;

Output:

LoanIDBranchAmountClientIDClient_Name
1B1200001Rohan Kapoor
2B2150004Rakesh Mehta
3B350000NULLNULL
4B41200002Meera Singh
5B5800003Tanya Verma
6B635000NULLNULL

Example 3: Customers and Orders

Consider two tables: buyers and purchases.

Buyers Table

BuyerIDBuyer_NameAgeSalary
1Aditya Roy3560000
2Priyanka Yadav2848000
3Raj Malhotra3075000
4Pooja Sharma2954000

Purchases Table

PurchaseIDPurchase_DateBuyerIDAmount
1012022-01-1024500
1022022-02-1537000

Query to Perform LEFT JOIN:

SELECT b.BuyerID, b.Buyer_Name, b.Age, b.Salary, p.PurchaseID, p.Purchase_Date, p.Amount
FROM buyers b
LEFT JOIN purchases p
ON b.BuyerID = p.BuyerID;

Output:

BuyerIDBuyer_NameAgeSalaryPurchaseIDPurchase_DateAmount
1Aditya Roy3560000NULLNULLNULL
2Priyanka Yadav28480001012022-01-104500
3Raj Malhotra30750001022022-02-157000
4Pooja Sharma2954000NULLNULLNULL

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

By using LEFT JOIN, you can efficiently combine data from multiple tables while ensuring that all records from the left table are included, even if no corresponding data exists in the right table.

For more such SQL tutorials, keep exploring UpdateGadh!


sql left join example
sql left join multiple tables
sql join
sql left join
sql left join example
linq to sql left join
sql left join vs right join
sql left join vs left outer join
sql left join on multiple columns
sql left outer join
sql left join vs right join
right join in sql
inner join in sql
cross join in sql

Post Views: 671
SQL Tutorial Tags:explain joins in sql, full join, inner join, joins in sql, joins in sql server, joins in sql with example, left join, mysql course, mysql full join, mysql inner join, mysql left join, mysql right join, mysql tutorial for beginners, right join, sql, sql course, sql course for beginners, sql for beginners, sql full join, sql inner join, sql joins, sql left join, sql right join, sql training, sql tutorial, sql tutorial for beginners

Post navigation

Previous Post: SQL OUTER JOIN: A Comprehensive Guide
Next Post: SQL RIGHT JOIN: A Comprehensive Guide

More Related Articles

SQL DELETE ROW SQL DELETE ROW: How to Remove Records from a Table SQL Tutorial
SQL CROSS JOIN Understanding SQL CROSS JOIN with Examples SQL Tutorial
SQL UPDATE DATE SQL UPDATE DATE: How to Update a Date and Time Field in SQL? 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