Solved

In what scenario should I using cross outer join?

Posted on 2014-01-23
2
878 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
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…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

920 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

16 Experts available now in Live!

Get 1:1 Help Now