Kamran Mushtaq
Back to Database
Database

LEFT JOIN

Added: June 23, 2026

Definition

LEFT JOIN is a SQL join that returns all rows from the left table and the matching rows from the right table. If no match exists, NULL values are returned for right table columns.

What Problem It Solves

It solves the need to keep all records from one table while still combining related data from another table, even when relationships are missing.

What Happens If Not Used

Without LEFT JOIN, you may only get matching records (INNER JOIN behavior) and lose unmatched rows from the left table.

Easy Wording

It “keeps everything from left side, matches from right if available.”

Technical Example

All customers are listed, even those who have no orders yet. Order details appear only if they exist. SELECT customers.name, orders.order_id FROM customers LEFT JOIN orders ON customers.id = orders.customer_id; Result: all customers shown, with NULL order_id if no order exists.