Skip to content

Instantly share code, notes, and snippets.

@vvgsrk
Last active October 18, 2021 19:24
Show Gist options
  • Save vvgsrk/dc2cdec2778a9069ed2822affb62d0ef to your computer and use it in GitHub Desktop.
Save vvgsrk/dc2cdec2778a9069ed2822affb62d0ef to your computer and use it in GitHub Desktop.
Joining More than Two Tables
-- Joining more than two tables with JOIN and ON keywords
SELECT e.last_name, d.department_name, l.city
FROM employees e JOIN departments d
ON (e.department_id = d.department_id)
JOIN locations l
ON (d.location_id = l.location_id);
-- Joining more than two tables with equal (=) operator
SELECT e.last_name, d.department_name, l.city
FROM employees e, departments d, locations l
WHERE e.department_id = d.department_id
AND d.location_id = l.location_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment