Skip to main content
SQL โ€ข LESSON 77

INNER JOIN

How can we retrieve employees together with their department names?

Intermediateโฑ 3 Minutesโญ 900 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