Re: foreign key references only part of composite PK - table scan issue
- From: bill <billmaclean1@xxxxxxxxx>
- Date: Sat, 8 Aug 2009 21:30:02 -0700 (PDT)
Are you allowed to add to the schema and do any redesign?
It sounds to me like table ABC is actually a relationship between two
missing tables (call them table 1 and table 2, after your column
names). If DEF needs a foreign key to only column 1, then there
should be a table whose primary key is just column 1. You also need a
table whose primary key is just column 2. Those two tables have a
many-to-many relationship that is resolved by table ABC.
Table DEF should be a child of table 1, and table MNO should be a
child of table 2. Neither DEF nor MNO should reference table ABC.
As I understand it from what what you wrote about the keys, adding
these two tables is the real answer. If you find that your
application has queries against ABC that use the DISTINCT keyword or a
GROUP BY clause, that would even be more confirmation that you need
the new tables.
Thanks,
Bill
.
- Follow-Ups:
- References:
- Prev by Date: Re: foreign key references only part of composite PK - table scan issue
- Next by Date: Re: foreign key references only part of composite PK - table scan issue
- Previous by thread: Re: foreign key references only part of composite PK - table scan issue
- Next by thread: Re: foreign key references only part of composite PK - table scan issue
- Index(es):
Relevant Pages
|
Loading