INNER JOIN vs OUTER JOIN

INNER JOIN returns only matching rows between tables.

SELECT e.first_name, d.department_name
FROM employees e
JOIN departments d ON e.department_id = d.department_id;

LEFT OUTER JOIN includes all rows from the left table.

SELECT e.first_name, d.department_name
FROM employees e
LEFT JOIN departments d ON e.department_id = d.department_id;

RIGHT OUTER JOIN includes all rows from the right table.

FULL OUTER JOIN includes rows from both tables whether matched or not.