SQL Tutorial

Understanding SQL LEFT JOIN with Examples

SQL LEFT JOIN
SQL LEFT JOIN

SQL LEFT JOIN

The LEFT JOIN (also known as LEFT OUTER JOIN) returns all records from the left table and the matching records from the right table. When no match exists, NULL appears in the right table columns.

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

Syntax

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

Example 1: Staff & Unit

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;

Returns every staff member; unmatched staff get NULL for unit columns.

Example 2: Credit & Client

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

All loans appear; loans without a client show NULL for client columns.

Example 3: Buyers & Purchases

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

LEFT JOIN vs RIGHT JOIN vs INNER JOIN

  • INNER JOIN: Only matching rows from both tables.
  • LEFT JOIN: All from left + matches from right (NULL where missing).
  • RIGHT JOIN: All from right + matches from left.

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

Conclusion

LEFT JOIN ensures you keep every row from the left table, even when there is no match on the right. It is perfect for reporting on optional relationships. For more SQL tutorials, keep exploring .

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

Source Code Available

Interested in This Project?

Get the complete source code for this project at a very affordable price — perfect for your portfolio, college submission, or learning. Message us on WhatsApp and we'll get back to you instantly!

Full source code included Step-by-step setup guide Instant delivery on WhatsApp Instant reply on WhatsApp
Chat on WhatsApp

We usually reply within a few minutes

Leave a Reply

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

Chat with us