BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Has foreign key (FK) to be linked to primary key (PK)...

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO)
View previous topic :: View next topic  
Author Message
Vladimir Stefanovic
Guest





PostPosted: Thu Dec 28, 2006 5:36 pm    Post subject: Has foreign key (FK) to be linked to primary key (PK)... Reply with 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?



Best Regards,
Vladimir Stefanovic
Back to top
Giuliano
Guest





PostPosted: Thu Dec 28, 2006 8:47 pm    Post subject: Re: Has foreign key (FK) to be linked to primary key (PK)... Reply with quote



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





PostPosted: Sun Dec 31, 2006 2:40 am    Post subject: Re: Has foreign key (FK) to be linked to primary key (PK)... Reply with quote



Thank you very much for the detailed expplanation.

--
Best Regards,
Vladimir Stefanovic
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.