🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
3 messages
3 total messages Started by Vladimir Stefanovic Thu, 28 Dec 2006 11:36
Has foreign key (FK) to be linked to primary key (PK)...
#432
Author: Vladimir Stefanovic
Date: Thu, 28 Dec 2006 11:36
9 lines
1099 bytes
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
Re: Has foreign key (FK) to be linked to primary key (PK)...
#433
Author: Giuliano
Date: Thu, 28 Dec 2006 14:47
28 lines
2245 bytes
On 28 Dec 2006 03:36:47 -0800, "Vladimir Stefanovic" <antivari@po.sbb.co.yu>
wrote:

>
>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
Re: Has foreign key (FK) to be linked to primary key (PK)...
#239
Author: Vladimir Stefanovic
Date: Sat, 30 Dec 2006 20:40
5 lines
1095 bytes
Thank you very much for the detailed expplanation.

-- 
Best Regards,
Vladimir Stefanovic 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads