 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Vladimir Stefanovic Guest
|
Posted: Thu Dec 28, 2006 5:36 pm Post subject: Has foreign key (FK) to be linked to primary key (PK)... |
|
|
What the most recent standard say about linking FK to other entity?
Has FK to be linked to PK of another entity, or it can by any
other appropriate indexed field?
Best Regards,
Vladimir Stefanovic |
|
| Back to top |
|
 |
Giuliano Guest
|
Posted: Thu Dec 28, 2006 8:47 pm Post subject: Re: Has foreign key (FK) to be linked to primary key (PK)... |
|
|
On 28 Dec 2006 03:36:47 -0800, "Vladimir Stefanovic" <antivari (AT) po (DOT) sbb.co.yu>
wrote:
| Quote: |
What the most recent standard say about linking FK to other entity?
Has FK to be linked to PK of another entity, or it can by any
other appropriate indexed field?
|
Hi Vladimir,
AFAIK, FK historically has to be linked to a PK because, the latter,
guarantees that it is unique, i.e. it characterizes one single row in the
recordset (aka a relation), so to make possible to create true master-detail
relationships.
In this manner, is possible to "objectize" (i.e. to characterize each singe
element) of a relation (2NF), i.e. the recordset is a "set" and not a "bag".
Specifying the PF-FK realtionship directly in SQL using the appropriate
constraint, many RDBMS manage directly and automatically all the referential
integrity issues for you.
However, I suppose that you can try to link a FK to any other index (better if
with a unique constraint), comparing field values in a query joining (with a
join) the underlying tables. But I think that, if you want to recreate a sort
of referential integrity, you have to write some server side triggers.
Regards.
Giuliano |
|
| Back to top |
|
 |
Vladimir Stefanovic Guest
|
Posted: Sun Dec 31, 2006 2:40 am Post subject: Re: Has foreign key (FK) to be linked to primary key (PK)... |
|
|
Thank you very much for the detailed expplanation.
--
Best Regards,
Vladimir Stefanovic |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|