🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #433

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

#433
From: 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
Technical Details
Message-ID: <erk7p29fvfi63dem3qob51tas0ftrllgbe@4ax.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!out02b.usenetserver.com!news.usenetserver.com!in01.usenetserver.com!news.usenetserver.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4593ac4f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,6045a5d40105b6cf
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Giuliano <>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Re: Has foreign key (FK) to be linked to primary key (PK)...
Date: Thu, 28 Dec 2006 15:47:28 +0100
Reply-To: gcardinali@ remove .zofm.net
Message-ID: <erk7p29fvfi63dem3qob51tas0ftrllgbe@4ax.com>
References: <4593ac4f$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 81.72.236.131
X-Trace: newsgroups.borland.com 1167317222 81.72.236.131 (28 Dec 2006 06:47:02 -0800)
Lines: 28
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!out02b.usenetserver.com!news.usenetserver.com!in01.usenetserver.com!news.usenetserver.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail