?
Solved

sql server 2008: LEFT JOIN and FULL JOIN

Posted on 2011-03-16
2
Medium Priority
?
743 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

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…
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.
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

719 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