Skip to main content
SQL • LESSON 77

INNER JOIN

How can we retrieve employees together with their department names?

Intermediate3 Minutes900 XP
🤔 THE QUESTION

How can we retrieve employees together with their department names?

💡 WHAT IS IT?

An INNER JOIN matches records from two tables where the specified ON condition evaluates to true.

🎯 WHAT IS IT USED FOR?

Resolving foreign keys, pairing employees with departments, joining orders to customers.

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

🎯 Mission Objectives

Practice typing production-grade SQL code for INNER JOIN.

  • INNER JOIN
  • Table aliases (e, d)
  • ON predicate
  • Foreign key resolution