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

How to generate query output in html format?

552


How to convert dates to characters in oracle?

568


Give the various exception types.

528


How many types of synonyms in Oracle?

581


How to create tables for odbc connection testing?

479






Can multiple columns be used in group by in oracle?

531


How to define a procedure inside another procedure?

536


what is Single Byte Overhead...?

2047


What is blob data type in oracle?

543


How would you edit your CRONTAB to schedule the running of /test/test.sh to run every other day at 2PM?

1423


Is it possible to set second Primary Key Constraint in a table in Oracle Database ?

633


What is a proxy object?

562


How to change program global area (pga) in oracle?

571


How to divide query output into groups in oracle?

548


How to use "out" parameter properly?

616