Joins

A join combines rows from two tables based on a matching column — useful when related data is split across tables instead of duplicated in one.

The departments table

This lesson adds a second table, departments, with a location for each department name:

view departments
Result

INNER JOIN

JOIN ... ON matches rows where the specified columns are equal — here, matching each employee's department name to a row in the departments table:

employees with department location
Result
Note: only rows with a match in both tables appear in the result of a plain JOIN (also called an inner join) — an employee whose department doesn't exist in the departments table would be left out.