Subject RE: [ib-support] Re: Primary key question
Author Helen Borrie
At 03:38 PM 17-04-01 +0200, you wrote:
>Hi,
>
> Thanks for your answer. You mean I have to use a generator then to make
>(force) a primary key ?

Nico,
Yes: it's known as a "surrogate key" - a unique value that represents one unique set of the elements that go to make up the "real" primary key.

Using a generator will make certain that this surrogate key is itself unique. You will have to apply a unique constraint across the columns of the existing key to ensure that the data itself obeys the requirement for uniqueness.

The surrogate key then replaces the repeated columns in any existing FOREIGN relations that are referring to this primary key, i.e. you would drop those columns from the foreign table and any of its dependents.

Cheers,
Helen



>Thanks
>
>Nico
>
>-----Oorspronkelijk bericht-----
>Van: ded_spb@... [mailto:ded_spb@...]
>Verzonden: dinsdag 17 april 2001 15:27
>Aan: ib-support@yahoogroups.com
>Onderwerp: [ib-support] Re: Primary key question
>
>
>--- In ib-support@y..., "Nico Callewaert" <ncw@c...> wrote:
> > Hi all,
> >
> > I'm planning to make a table and the primary key of that table
>would be a
> > combination of 4 fields. Would such a primary key slow down my
>queries ?
> > Is a one field primary key better ??
> >
>
>Hi, Nico.
> Yes. And more: if you need references on the table with composite
>primary, you need to include all it's segments into tables that
>references on it even if nature of the table does not reqiure this.
>For uniquity of columns that define "natural" primary, you always can
>create general unique index on this columns and use it where it is
>needed.
>
>Best regards.
>
>
>
>To unsubscribe from this group, send an email to:
>ib-support-unsubscribe@egroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>To unsubscribe from this group, send an email to:
>ib-support-unsubscribe@egroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________