Harvinder,

Every table needs a PK.  Otherwise, you have no way of identifying a row
uniquely.

You also need an index on each FK, to prevent locking problems when
updating/deleting the parent table.  You can kill two birds with one stone
by making your history tables' PKs (enforced by unique indexes) be a
concatenation of the FK column(s) - make it(them) the leading column(s) -
with at least one more column that produces a unique ID for each row.

Then you've got both a PK and an indexed FK and everyone is happy! ...except
maybe your duhvelopers, who are obviously not all that knowledgeable, so who
cares if they're happy?!?!  ;-)

Jack

--------------------------------
Jack C. Applewhite
Database Administrator/Developer
OCP Oracle8 DBA
iNetProfit, Inc.
Austin, Texas
www.iNetProfit.com
[EMAIL PROTECTED]
(512)327-9068


-----Original Message-----
Singh
Sent: Thursday, March 07, 2002 11:13 AM
To: Multiple recipients of list ORACLE-L


HI,

We have some history tables that are pointing to parent tables.
Parent tables has primary key.
Our developers are saying that we have foreign key from history table to
parent table and we don't need primary key on history table.
Does there are any benefits if we have primary key(concatenated) on history
table. OR
do we should leave history tables without primary key

Thanks
--Harvinder
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Harvinder Singh
  INET: [EMAIL PROTECTED]



-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jack C. Applewhite
  INET: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).

Reply via email to