?
Solved

Detecting a cartesian product

Posted on 2004-04-16
6
Medium Priority
?
893 Views
Last Modified: 2012-08-14
I am developing a query builder form something similar to TOAD.
When the user selects multiple columns from various tables i need to detect whether the tables can be joined or not. I want this to be done so that i can avoid a cartesian product when the final query is built and run on the server.
Is there a way to detect if two tables would cause a cartesian product / not.
0
Comment
Question by:vikramrathour
[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
6 Comments
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 10848409
which database system?

how are you expecting the joins to be specified anyway?

0
 

Author Comment

by:vikramrathour
ID: 10848532
I am using Oracle Database.
The joins will either be specified by the user or i would be picking up the primary keys of both tables and try and equate them.
Thats what i am thinking of right now but can some one tell me a better solution.
0
 
LVL 50

Accepted Solution

by:
Lowfatspread earned 100 total points
ID: 10848545
in the main your joins will be on a foreign key to primary key basis  
if your dealing with normalised tables....

the simple way to stop catesian product would be to "demand" the join criteria whenever the user starts to
use a column from a new table...

to automatically do it / present some options to the user then you need to query the "system catalog/tables"
to attempt to detect the foreign key relationsships / indexes available and
present them as options....

sorry i'm not an Oracle "Expert"
0
 
LVL 6

Assisted Solution

by:musdu
musdu earned 100 total points
ID: 10848626
Hi,

you can find primary key-foreign key relations between tables and columns using dba_constraints table.

regards
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

777 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