SQL • LESSON 21
FULL OUTER JOIN
Learn how to return matching rows and unmatched rows from both tables.
🔴 Advanced⏱ 3 Minutes⭐ 380 XP
🤔 THE QUESTION
How can we combine the results of two separate SQL queries into one result?
💡 WHAT IS IT?
UNION combines the result sets of two compatible SELECT statements and removes duplicate rows.
🎯 WHAT IS IT USED FOR?
It is useful when the same type of information comes from different queries or tables and you want one combined result.
💻 EXAMPLE
SELECT name
FROM employees
WHERE department = 'IT'
UNION
SELECT name
FROM employees
WHERE department = 'HR';Mission Brief
Practice using FULL OUTER JOIN to return all employees and all departments, including records without a match.
Objectives
- ✓ SELECT
- ✓ FROM
- ✓ FULL OUTER JOIN
- ✓ ON
- ✓ Unmatched rows