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 implicit cursor in oracle?

658


What are the different pseudo commands? Explain in general?

656


How to grant create session privilege to a user in oracle?

649


Please explain oracle left join with an example?

667


How to get a list of all background sessions in the database?

626






What are the differences between blob and clob in oracle?

665


What is a tns service name?

616


How to unlock the sample user account in oracle?

623


How to call a sub procedure?

668


What are the attributes of cursor?

687


What are the logical operations?

768


What is a proxy class?

639


Please explain me all types of Data models. Also give me the details if each model can have other name.for example:schematic data model is also known as conceptual data model and entity relation data model.

1948


Where is the export dump file located?

657


What is the difference between hot backup and cold backup in oracle? Tell about their benefits also.

634