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: What is the difference between UNIQUE and PRIMARY KEY?

Re: What is the difference between UNIQUE and PRIMARY KEY?

From: Bart <Bart_at_opcomp.demon.co.uk>
Date: Thu, 12 Apr 2001 19:29:24 +0100
Message-ID: <987100539.8124.0.nnrp-14.9e985e86@news.demon.co.uk>

I stand corrected. A foreign key can reference a primary key or a unique key.

"Brian Tkatch" <SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK> wrote in message news:3ad4d887.91294906_at_news.alt.net...
> On Wed, 11 Apr 2001 22:17:29 +0100, "Bart" <Bart_at_opcomp.demon.co.uk>
> wrote:
>
> >A primary key is, by definition, the primary key to a table and a table
 can
> >have only one.
> >
> >A primary key is not an index, although is usually has an associated
 index.
> Usually? It always has one. If you do not specify one in the clause,
> it will create one of the same name.
> >
> >A table can have any number of unique indexes.
> >
> >A foreign key can only reference a primary key.
> You mean a Foreign Key when not specifiying a column looks for the
> primary key. It can reference either a primary or a unique key.
>
> create table a (a number unique, b number references a(a))
>
> I would guess a Primary Key is the same thing as not null and unique
> index. It just is the default reference for foreign keys, and other
> programs (such as access) which require a key for updating, will look
> for the primary key.
>
> Brian
Received on Thu Apr 12 2001 - 13:29:24 CDT

Original text of this message

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