Skip to main content
SQL โ€ข LESSON 17

SQL INNER JOIN

How do we combine rows from two tables where matching keys exist in both?

Intermediateโฑ 2 Minutesโญ 300 XP
๐Ÿค” THE QUESTION

How do we combine rows from two tables where matching keys exist in both?

๐Ÿ’ก WHAT IS IT?

INNER JOIN returns only the rows that satisfy the matching condition in both tables.

๐ŸŽฏ WHAT IS IT USED FOR?

Joining orders with customer details, employees with departments, transactions with accounts.

๐Ÿ’ป EXAMPLE
SELECT employees.name,
departments.department_name
FROM employees
INNER JOIN departments
ON employees.department_id = departments.id;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for SQL INNER JOIN.

  • โœ“ INNER JOIN
  • โœ“ ON condition
  • โœ“ Foreign Keys
  • โœ“ Table joins