Solved

sql server 2008: LEFT JOIN and FULL JOIN

Posted on 2011-03-16
2
729 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 250 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 250 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
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 video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now