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

Home -> Community -> Usenet -> c.d.o.server -> Re: Is Primary Key always the index of the table in Oracle?

Re: Is Primary Key always the index of the table in Oracle?

From: Arto Viitanen <arto.viitanen_at_csc.fi>
Date: Tue, 06 Mar 2007 09:49:02 +0200
Message-ID: <45ed1cee$0$1723$ba624cd0@newsread.funet.fi>


Kaka wrote:
> Can someone explain to me if the Primary Key always the same as Index
> of the table in Oracle? If not, how are they related? Thank you in
> advance!
>

Index is a structure Oracle uses in accessing the table, when it feels it is faster to do so. Indexes have one or several attributes of the table and a reference to the rows in the table that have those values. The index can be built so that there can be only one row associated to the attribute(s). If this is the case, one cannot add another row with same values without violating the constraint.

Since primary key is a constraint that an attribute or attributes of the table can have only one row per one value of the attribute (or set of attributes if there are more than one), almost all RDBMSs make an index for the primary key. But, you can add more indexes to the table, and remove them if you like.

-- 
Arto Viitanen, CSC Ltd.
Espoo, Finland
Received on Tue Mar 06 2007 - 01:49:02 CST

Original text of this message

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