DATABASE & SQL/PLSQL

adplus-dvertising
Outer Join
Previous Home Next

An outer join displays NULL for the columns of the related table where it does not find matching records.

When the result set contains all rows from one table

The matching rows from other

SELECT columnm_name 1, columnm_name 2....columnm_name n
FROM table_name [LEFT,RIGHT] OUTER JOIN table_name
ON [table_name.ref_column_name]  join_operator  [table_name.ref_column_name]

Left Outer Join: Left outer join ensure the inclusion of rows the first table and the matching rows from the second table.

SELECTlogo,price,notes
FROM pub_info p LEFT OUTER JOIN titles t>
ON p.pub_id=t.pub_id

Right Outer Join: Right outer join ensure the inclusion of rows the second table and the matching rows from the first table.

SELECT logo,price,notes
FROM pub_info p RIGHT OUTER JOIN titles t
ON  p.pub_id=t.pub_id
Previous Home Next