Solved

In what scenario should I using cross outer join?

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

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
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…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

803 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