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

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

From: David Pomphrey <High.Flight_at_btinternet.com>
Date: Sun, 22 Apr 2001 03:33:08 +0100
Message-ID: <3AE242E4.5098@btinternet.com>

UNIQUE = UNIQUE (excludes nulls from the test)

UNIQUE + NOT NULL constraint = PRIMARY KEY

D.P.

Niall Litchfield wrote:
>
> This explanation makes sense when you think of relational theory
>
> If a table is normalized as much as possible then each record must be
> uniquely identifiable and there must be a value for each row which uniquely
> identifies it. I'd go further and suggest that if as well as a primary key
> you also find yourself making unique,not null constraints on non-key columns
> something has gone awry with the db design. (or possibly the implementation
> we have an app where every field in every table is not null and has an
> associated default value this doesn't feel like good design to me).
>
> --
> Niall Litchfield
> Oracle DBA
> Audit Commission UK
> "Steve Bell" <swayne.bell_at_sympatico.ca> wrote in message
> news:3AD590A9.D5785B7A_at_sympatico.ca...
> > Hi,
> >
> > A unique field requires that each entry be different (unique) from every
> > other record OR NULL.
> >
> > A primary key imposes a second condition, namely the NOT NULL
> > condition...so, the field must be both unique and not null.
> >
> > Hope this helps,
> > Steve
> >
> > u518615722_at_spawnkill.ip-mobilphone.net wrote:
> >
> > > I searched against metalink and could not find the
> > > definition of unique index, could somebody help
> > > me out?
> > >
> > > Thanks
> > >
> > >
> > > --
> > > Sent by dbadba62 from hotmail subpart of com
> > > This is a spam protected message. Please answer with reference header.
> > > Posted via http://www.usenet-replayer.com/cgi/content/new
> >
Received on Sat Apr 21 2001 - 21:33:08 CDT

Original text of this message

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