#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
Step 9
4 min read

LEFT JOIN

Keep ALL records from the left table, even without matches.

What is LEFT JOIN?

LEFT JOIN shows ALL rows from the left table, even if no match exists in the right table.

Simple rule: Left table = Always shown, Right table = Only if match

How LEFT JOIN Works

Basic Syntax

SELECT columns FROM left_table LEFT JOIN right_table ON left_table.id = right_table.foreign_id;

Example: All Students with Orders

SELECT students.name, orders.product FROM students LEFT JOIN orders ON students.id = orders.student_id;

Result: John, Mary AND Peter (Peter shows NULL for product)

LEFT JOIN vs INNER JOIN

  • INNER JOIN → Only matching rows (John, Mary)
  • LEFT JOIN → All from left + matches (John, Mary, Peter with NULL)

When to Use

  • Find customers who never ordered
  • List all products including unsold ones
  • Show all employees even without assigned projects

Try It Below

Practice with pre-joined LEFT JOIN results!

What Comes Next

Next: RIGHT JOIN - opposite of LEFT JOIN.

Finished this topic?

Mark it complete to track your progress and maintain your streak!