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

Can we write dml statement in function in oracle?

637


How to start a new transaction in oracle?

593


What is a nvl function? How can it be used?

564


How to insert multiple rows with one insert statement in oracle?

572


Why cursor variables are easier to use than cursors?

573






How to name query output columns in oracle?

692


What is an Oracle Instance?

688


Explain the use of tables option in exp command.

595


What is bulk collect in oracle?

556


How to connect the oracle server as sysdba?

633


What are the oracle built-in data types?

565


Compare and contrast between sql and sql server and explain its various functions?

538


What is null value in oracle?

638


what is normalisation?what are its uses?

1763


how do u setup a replication site?

1502