Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

sql server 2008: LEFT JOIN and FULL JOIN

Posted on 2011-03-16
2
Medium Priority
?
745 Views
Last Modified: 2012-06-21
Hi experts

--3.2
SELECT p.Name, sod.SalesOrderID --238 rows
FROM Production.Product AS p
LEFT JOIN Sales.SalesOrderDetail AS sod
ON p.ProductID = sod.ProductID
WHERE p.ProductID IS NULL OR sod.ProductID IS NULL
ORDER BY p.Name ;

--3.3
-- The OUTER keyword following the FULL keyword is optional.
SELECT p.Name, sod.SalesOrderID --238 rows
FROM Production.Product AS p
FULL JOIN Sales.SalesOrderDetail AS sod
ON p.ProductID = sod.ProductID
WHERE p.ProductID IS NULL OR sod.ProductID IS NULL
ORDER BY p.Name ;

it is the same use left and full join?
 They have some example where you can see the difference?
0
Comment
Question by:enrique_aeo
2 Comments
 
LVL 19

Assisted Solution

by:Bhavesh Shah
Bhavesh Shah earned 1000 total points
ID: 35153767
Hi,

No its not same.

check out this basic link.

http://en.wikipedia.org/wiki/Join_(SQL)

it will help you to know the difference with examples.


- Bhavesh
0
 
LVL 9

Accepted Solution

by:
kaminda earned 1000 total points
ID: 35153935
In the left outer join you get (left join) values matching both tables on the given columns as well as the values exsists in the Left side of the join table with nulls for the right side table values.

In the Full Outer Join you get values matching both tables on the given columns as well as all the unmatching rows from both tables with nulls for the unmatching values.

In your case your getting same results because of the data you have.

This link has a perfect explaination on all outer joins http://www.quackit.com/sql/tutorial/sql_outer_join.cfm
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question