SQL · Pattern 6 — Joins
Multiple JOINs
Multiple JOINs combine data from more than two related tables in a single query.
Source data — Pattern 6: Joins
All queries run against the shared employees and departments tables (see schema.sql). This pattern introduces the departments table. Topic 38 also needs a projects table, while topic 39 introduces a salary_grades table for non-equi joins.




What it does
Multiple JOINs combine data from more than two related tables in a single query.
Problem
Display employee, department, and project names.
SELECT e.first_name,
d.department_name,
p.project_name
FROM employees e
INNER JOIN departments d
ON e.department_id = d.department_id
INNER JOIN projects p
ON e.project_id = p.project_id;
Result
