Verduidelijk hoe u de rechter en linker outer join correct kunt vinden met een voorbeeld
Ik zal proberen het verschil tussen Oracle outer join-syntaxis te laten zien en de ANSI/ISO-syntaxis .
LINKER BUITENSTE JOIN -
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);
RIGHT OUTER JOIN -
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);
VOLLEDIGE OUTER JOIN -
Vóór de native ondersteuning van hash full outerjoin in 11gR1, zou Oracle de FULL OUTER JOIN op de volgende manier intern converteren -
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);
Kijk hier eens naar.