Re: Primary Keys

From: Gordon Hooker <gordonh_at_acslink.net.au>
Date: 1995/04/26
Message-ID: <3nklvt$457_at_dingo.cc.uq.oz.au>#1/1


cooper_at_cimage.com (Wendy Cooper) wrote:

>[ Article crossposted from comp.databases.oracle ]
>[ Author was Steve Butler ]
>[ Posted on Wed, 19 Apr 1995 12:45:54 -0700 ]

>On 13 Apr 1995, pconnors on BIX wrote:
>> DPWCC02.OBERLE02_at_SSW.ALCOA.COM (Oberle, John F.) writes:
>> >Can someone tell me the significance of the primary key
>> >constraint. What are the advantages or disadvantages over
>> >creating unique indexes.

Although a unique index does not allow duplication of a row in the table based on that key, it quite different to a Primary Key. A primary key is a conceptual object used to enforce referential integrity. A unique index is a physical object used to enforce the PK or a Uniqueness constraint.

Without rambling on too much, basically a PK is used in conjunction with a FK to stop detail rows being inserted into the database without a corresponding master row. I think you would find if you created a unique index it would be used to enforce the PK contraint rather than creating the PK first.

Gordon
>> The primary key constraint creates a unique index, but it
>> uses a system-generated name and defaults the storage and
>> tablespace. For that reason, our shop is putting a standard
>> in place that constraints are to have the index name
>> and storage info created explicitly.
 

>Perhaps in versions prior to 7.0.16. (There was a minor problem I ran
>into in 7.0.13 having to do with EXP and IMP.)
 

>Now you can specify the storage paremeters and tablespace for the primary
>key constraint within the CREATE TABLE statement.
 

>+----------------------------------------------------+
>| Steve Butler Voice: 206-464-2998 |
>| The Seattle Times Fax: 206-382-8898 |
>| PO Box 70 Internet: sbut-is_at_seatimes.com |
>| Seattle, WA 98111 Packet: KG7JE_at_N6EQZ.WA |
>+----------------------------------------------------+
>All standard and non-standard disclaimers apply.
>All other sources are annonymous.

gordonh_at_acslink.net.au
RIPLEY, Queensland, Australia Received on Wed Apr 26 1995 - 00:00:00 CEST

Original text of this message