Solved

In what scenario should I using cross outer join?

Posted on 2014-01-23
2
866 Views
Last Modified: 2014-01-24
When can I user cross outer join in SQL Server?
0
Comment
Question by:RajG1978
2 Comments
 
LVL 12

Assisted Solution

by:Koen Van Wielink
Koen Van Wielink earned 250 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 250 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

743 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

15 Experts available now in Live!

Get 1:1 Help Now