A LEFT OUTER JOIN (or simply LEFT JOIN) returns all records from the left table, along with matching records from the right table. If no match is found, columns from the right table are filled with NULL. This join ensures that all rows from the left table are preserved, even if no corresponding records exist in the right table.

In other words, grab everything from Table A, as well as anything in Table B that is also in Table A.

SELECT * FROM TableA
LEFT OUTER JOIN TableB
ON TableA.col_match = TableB.col_match

Note that we can also use the left join to find rows that are unique to Table A using a WHERE clause:

SELECT * FROM TableA
LEFT OUTER JOIN TableB
ON TableA.col_match = TableB.col_match
WHERE TableB IS null

Example

Given two tables:

Customers

idnamecity
1AliceNew York
2BobChicago
3CharlieSan Diego
4DavidMiami

Orders

idcustomer_idproduct
11Laptop
21Keyboard
33Monitor
45Mouse

Executing a LEFT JOIN:

SELECT Customers.name, Orders.product  
FROM Customers  
LEFT JOIN Orders ON Customers.id = Orders.customer_id;

Result:

nameproduct
AliceLaptop
AliceKeyboard
CharlieMonitor
BobNULL
DavidNULL

Explanation:

  • Alice and Charlie had matching orders, so they appear with their respective products.
  • Bob and David had no matching orders, so NULL appears in the product column.
  • The order for customer ID 5 (Mouse) is not included, since it has no match in Customers.

Key Differences from Other Joins

Join TypeIncludes Unmatched Rows?Where Do NULLs Appear?
INNER JOIN❌ NoNo unmatched rows
LEFT JOIN✅ Yes (left table)Right table columns
RIGHT JOIN✅ Yes (right table)Left table columns
FULL OUTER JOIN✅ Yes (both tables)Both sides where no match exists