What are inner join and outer join?

Answer Posted / pandian raman

Inner Join (simple join)

Inner joins return all rows from multiple tables where the
join condition is met.

For example,
SELECT suppliers.supplier_id, suppliers.supplier_name,
orders.order_date FROM suppliers, orders
WHERE suppliers.supplier_id = orders.supplier_id;

This SQL statement would return all rows from the suppliers
and orders tables where there is a matching supplier_id
value in both the suppliers and orders tables.
Outer Join

This type of join returns all rows from one table and only
those rows from a secondary table where the joined fields
are equal (join condition is met).

For example,

select suppliers.supplier_id, suppliers.supplier_name,
orders.order_date from suppliers, orders where
suppliers.supplier_id = orders.supplier_id(+);

This SQL statement would return all rows from the suppliers
table and only those rows from the orders table where the
joined fields are equal.

The (+) after the orders.supplier_id field indicates that,
if a supplier_id value in the suppliers table does not exist
in the orders table, all fields in the orders table will
display as <null> in the result set.

The above SQL statement could also be written as follows:

select suppliers.supplier_id, suppliers.supplier_name,
orders.order_date from suppliers, orders where
orders.supplier_id(+) = suppliers.supplier_id

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the maximum limit on the number of columns in a table?

551


How to start your 10g xe server?

596


Give the various rollback segment states.

579


What is the best way to do multi-row insert in oracle?

563


How are extents allocated to a segment?

578






What is an anonymous block?

625


How to connect the oracle server as sysdba?

633


In the oracle version 9.3.0.5.0, what does each number shows?

749


What do you mean by cdb and pdb in oracle 12c?

641


How many types of auditing in Oracle?

566


What are group functions in oracle?

585


Explain about your project and its relation to the current job position you are applying to?

546


What are the tools for Oracle ?

609


How to rebuild an index in oracle?

552


What is an oracle cursor variable?

609