Module lessons (1/4)
Joining Two Tables: INNER JOIN
Combine matching rows across tables along primary and foreign keys.
What you'll learn in this lesson
- Link two tables along the Primary Key ↔ Foreign Key relationship using
INNER JOIN ... ON. - Always qualify ambiguous columns with short table aliases (
e,d,b,a). - Understand why records with foreign key
NULLare excluded fromINNER JOIN.
Overview
In normalized relational databases, data lives in separate tables to avoid duplicates: employees stores department_id, while the department name lives in departments. INNER JOIN (abbreviated as JOIN) combines the rows of the two tables only when the condition ON is true.
Click the INNER vs LEFT buttons below to see how INNER JOIN retains only the central intersection excluding Diana (NULL) and Evan (FK orphan), as well as the empty Legal and Research departments:
Sections covered in this lesson
- 11. Mental Model: Intersection between Left and Right Table
- 22. Progressive & Annotated Examples
- 33. Interactive Lab: View the INNER JOIN
- 44. Diagnostic Verification (Quiz)
- 55. Progressive Practical Laboratory
Unlock "Joining Two Tables: INNER JOIN" and the full SQL Course curriculum
Combine matching rows across tables along primary and foreign keys.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in SQL Course plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.