Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: RE: Primary keys vs. unique indexes
This is in the very definition of the parent/child relationship. A child
has one and only one parent. That way when you join parent table with the
child table you get one row per each child. In order to enforce that "one
parent" requirement there should be a unique constraint on that field in the
parent table.
Djordje
-----Original Message-----
From: Cyril Thankappan
To: Multiple recipients of list ORACLE-L
Sent: 12/2/00 2:20 AM
Subject: Re: RE: Primary keys vs. unique indexes
Hi!
Yes true, but I have not been able to understand WHY the primary key is required to define the foreign key..
Please understand me, I am aware that Oracle has put a restriction of primary/unique key being pre-requisite for foreign key definition, but I am trying to understand the 'reason' behind imposing that restriciton..
Perhaps some design 'guru' can help...
Hannah r u listening!
of course you can.
to quote the 8.1.6 SQL Reference manual restrictions on foreign keys:
The referenced UNIQUE or PRIMARY KEY constraint on the parent table must
already be defined.
seems to me that that is pretty clear
>From: "Koivu, Lisa" <lkoivu_at_qode.com>
>Reply-To: ORACLE-L_at_fatcity.com
>To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
>Subject: RE: Primary keys vs. unique indexes
>Date: Thu, 30 Nov 2000 09:20:22 -0800
>
>What? Yes you can. I have anyway.
>
>Can you give me an example of when that would not work?
>
>Lisa Rutland Koivu
>Oracle Database Administrator
>Qode.com
>4850 North State Road 7
>Suite G104
>Fort Lauderdale, FL 33319
>
>V: 954.484.3191, x174
>F: 954.484.2933
>C: 954.658.5849
>http://www.qode.com
>
>"The information contained herein does not express the opinion or
position
>of Qode.com and cannot be attributed to or made binding upon Qode.com."
>
>
>-----Original Message-----
>Sent: Thursday, November 30, 2000 11:51 AM
>To: Multiple recipients of list ORACLE-L
>
>
>The main difference is you can not reference an unique
>index with a foreign key.
>--- cemail_at_sprintmail.com wrote:
> >
> > What is the difference between building a table and
> > including
> > the primary key versus building the table and then
> > having creating
> > a unique index on the same keys? When you create a
> > table with
> > a primary key, doesn't Oracle store it as an index
> > anyway?
> >
> > -----
> > Sent using MailStart.com (
> > http://MailStart.Com/welcome.html )
> > The FREE way to access your mailbox via any web
> > browser, anywhere!
> >
> > --
> > Please see the official ORACLE-L FAQ:
> > http://www.orafaq.com
> > --
> > Author:
> > INET: cemail_at_sprintmail.com
> >
> > Fat City Network Services -- (858) 538-5051 FAX:
> > (858) 538-5051
> > San Diego, California -- Public Internet
> > access / Mailing Lists
> >
>--------------------------------------------------------------------
> > To REMOVE yourself from this mailing list, send an
> > E-Mail message
> > to: ListGuru_at_fatcity.com (note EXACT spelling of
> > 'ListGuru') and in
> > the message BODY, include a line containing: UNSUB
> > ORACLE-L
> > (or the name of mailing list you want to be removed
> > from). You may
> > also send the HELP command for other information
> > (like subscribing).
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Shopping - Thousands of Stores. Millions of Products.
>http://shopping.yahoo.com/
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>--
>Author: james ellis
> INET: jellis24_gso_at_yahoo.com
>
>Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
>San Diego, California -- Public Internet access / Mailing Lists
>--------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Rachel Carmichael INET: carmichr_at_hotmail.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). _____________________________________________________ Chat with your friends as soon as they come online. Get Rediff Bol at http://bol.rediff.com Participate in crazy auctions at http://auctions.rediff.com/auctions/ -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Cyril Thankappan INET: cyril_thank_at_rediffmail.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Sat Dec 02 2000 - 17:38:30 CST
![]() |
![]() |