what is inner join and outer join., differnce between both
what is inner join and outer join., differnce between both
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted May 28, 2012, 11:43 AM
Please refer the below links
http://www.programmerinterview.com/index.php/database-sql/inner-vs-outer-joins/
http://www.firebirdfaq.org/faq93/
Thanks
Chintan RathodPosted May 28, 2012, 11:15 AM
Inner Join
===================
The INNER JOIN keyword return rows when there is at least one match in both tables.
Syntax:SELECT column_name(s)
FROM table_name1
INNER JOIN table_name2
ON table_name1.column_name=table_name2.column_name
Person Table:
Order Table:
Example:
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
INNER JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName
Output:
=======================
Outer Join
=======================
The LEFT JOIN keyword returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2).
The result set of a left outer join includes all the rows from the left table specified in the LEFT OUTER clause, not just the ones in which the joined columns match. When a row in the left table has no matching rows in the right table, the associated result set row contains null values for all select list columns coming from the right table.
Syntax:
SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
Person Table
Orders Table
Example
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
LEFT JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName
Output
Thanks & Regards
-----------------
Chintan Rathod