Skip to main content
SQL • LESSON 79

LEFT JOIN

How can we keep employees even when they have no department match?

Intermediate3 Minutes920 XP
🤔 THE QUESTION

How can we keep employees even when they have no department match?

💡 WHAT IS IT?

A LEFT JOIN preserves all rows from the left table, filling non-matching right-table fields with NULL.

🎯 WHAT IS IT USED FOR?

Preserving all employees, unassigned staff auditing, optional relationship joins.

💻 EXAMPLE
SELECT e.name, d.department_name
FROM employees e
LEFT JOIN departments d
ON e.department_id = d.department_id;

🎯 Mission Objectives

Practice typing production-grade SQL code for LEFT JOIN.

  • LEFT JOIN
  • Outer join
  • Preserving left rows
  • NULL handling