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

Home -> Community -> Usenet -> c.d.o.tools -> Re: primary keys

Re: primary keys

From: Allen Kirby <akirby_at_att.com>
Date: 1997/06/13
Message-ID: <33A17ECB.966@att.com>#1/1

Randy A. Stebbins wrote:
<snip>
> I don't think you want a sequence. Sequences are for using ordered lists

Whoa, there. I believe the most common use of sequences is to generate a unique number (if you don't allow wrapping) to be used as a key or part of a key. It is perfectly valid to use something like this as a primary key in two circumstances:

  1. To improve performance in cases where the real primary keys are numerous columns and/or large in size. This is really a denormalization.
  2. In cases where the attributes CAN'T uniquely identify a row. Take ORDER, for example. I can enter two orders for the same stuff for the same customer at exactly the same second, so all the 'natural' data is identical. So you add order_number as the primary key. This works because the process decides when to create a new order, and it's not simply derived from the data itself. This really should be done in the design phase at a logical level and would not be just a denormalization.

> of numbers. A primary key is not something separate from a table. It is
> one (or more) columns of the table itself. When you identify a primary key
> for a table, Oracle creates an index on the key, and prevents any duplicate
> entries.
>

<snip>

-- 
Allen Kirby			AT&T ITS Production Services
akirby_at_att.com			Alpharetta, GA.
Received on Fri Jun 13 1997 - 00:00:00 CDT

Original text of this message

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