Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

In what scenario should I using cross outer join?

Posted on 2014-01-23
2
Medium Priority
?
955 Views
Last Modified: 2014-01-24
When can I user cross outer join in SQL Server?
0
Comment
Question by:RajG1978
[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 13

Assisted Solution

by:Koen Van Wielink
Koen Van Wielink earned 1000 total points
ID: 39805571
A cross join produces the cartesian product of the tables you combine (all rows from table 1 x all rows from table 2). One application I can think of is if you're trying to analyze certain scenarios, and you need to have a list of all possible combinations that make up a scenario.
For example, say that you have a list of motherboard parts in 1 table, and a list of CPU parts in another table, and you want to generate a list of all the possible combinations of motherboards and CPU's (e.g. for a price list) you can use a cross join on both tables to do this.
If you use a cross join but put a link between the 2 tables in the WHERE clause it will behave like a normal inner join.
More info here:
http://technet.microsoft.com/en-us/library/ms190690(v=sql.105).aspx
0
 
LVL 13

Accepted Solution

by:
magarity earned 1000 total points
ID: 39805573
When you have a requirement that needs that functionality; not sure how anyone here could answer that for you. Typically for a matrix of every combination: suppose you want a matrix of every color for every dress for every size:
select color, size, dress from color_table, size_table, dress_table
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

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 wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

705 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