Aclare cómo encontrar la combinación externa derecha e izquierda correctamente con un ejemplo
Intentaré mostrar la diferencia entre la sintaxis de unión externa de Oracle y la sintaxis ANSI/ISO .
UNIÓN EXTERNA IZQUIERDA -
SELECT e.last_name,
d.department_name
FROM employees e,
departments d
WHERE e.department_id = d.department_id(+);
SELECT e.last_name,
d.department_name
FROM employees e
LEFT OUTER JOIN departments d
ON (e.department_id = d.department_id);
UNIÓN EXTERNA DERECHA -
SELECT e.last_name,
d.department_name
FROM employees e,
departments d
WHERE e.department_id(+) = d.department_id;
SELECT e.last_name,
d.department_name
FROM employees e
RIGHT OUTER JOIN departments d
ON (e.department_id = d.department_id);
UNIÓN EXTERNA COMPLETA -
Antes del soporte nativo de hash full externaljoin en 11gR1, Oracle convertía internamente FULL OUTER JOIN de la siguiente manera:
SELECT e.last_name,
d.department_name
FROM employees e,
departments d
WHERE e.department_id = d.department_id(+)
UNION ALL
SELECT NULL,
d.department_name
FROM departments d
WHERE NOT EXISTS
(SELECT 1 FROM employees e WHERE e.department_id = d.department_id
);
SELECT e.last_name,
d.department_name
FROM employees e
FULL OUTER JOIN departments d
ON (e.department_id = d.department_id);
Echa un vistazo a esto.