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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Primary Key vs Unique

Re: Primary Key vs Unique

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 21 Dec 2003 12:16:08 -0800
Message-ID: <2687bb95.0312211216.6b8c7cf8@posting.google.com>


"Jawahar Rajan" <jrajan_at_cts-du.com> wrote in message news:<8l8Fb.142830$Vu5.9295016_at_twister.southeast.rr.com>...
> All,
> I have a table with 5 columns the first two are a primary key combined.
> for example
> Table Test1
> columns Col1, col2, col3,col4,col5
> the primary key is on col1 and col2 as combined because col1 is repeated.
> For reasons beyond my control I am not allowed to seprate the col1 data to
> another table.
> But as I am using a combined Primary key can I Reference either colum as a
> Foregin key in another table?
>
> Any reasons why not?
> What if I make the columns unique and have a seprate ID column would I them
> be able to reference them as foregin key in another table\?
>
> Any help is appreciated.
> Thanks
>
> Jawahar

If table A has a multi-column PK then any FK reference to Table A should be on all columns that make up the PK otherwise the two tables are not truely related and the FK relationship should probably be to a different table if it exists at all.

If the PK table is not normalized correctly then the loss of the ability to define a FK in the database may be a consequence, but trigger logic should be able to takes it place.

HTH -- Mark D Powell -- Received on Sun Dec 21 2003 - 14:16:08 CST

Original text of this message

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