Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: One Conceptual Question

Re: One Conceptual Question

From: Winnie Liu <poohland_at_hotmail.com>
Date: Fri, 24 Jul 1998 21:50:34 -0700
Message-ID: <6pbnuq$3pb@sjx-ixn4.ix.netcom.com>


Primary key is to enforced each row are unique to each other. No two rows will be the name and it can be uniquely identified by a key (Primary key). I think it is the 3rd normalization rule. Since it is going to be a unique identifier, it got to be unique and not null. A unique index will be automatically created by Oracle when you enforce the primary key constraint. But you can also create your own unique index and then enable the primary constraint. Then Oracle will use your index instead of creating another one.

You can always create some other unique index on other columns (for example, secordary primary key). You can create as many unique index as you want. But there will always be one primary key.

As for foreign key, it is to enforce that the content in the child table must exist in the parent's table. And the content in the parent table cannot be deleted unless the corresponding content be deleted in the child table. This is to enforce the consistency of the data between parent and child table.

Hope it can help! =D

Winnie

Violin wrote in message <35b950f7.13463390_at_172.16.7.252>...
>Hello,
>I'm a little confused about index,primary key, foreign key,
>If i create a unique index,the raws will be arranged by the index.
>But what are primary key and foreign key purpose??
>Thanks for your explanation!
>
>Violin
Received on Fri Jul 24 1998 - 23:50:34 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US