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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Surrogate keys

RE: Surrogate keys

From: Mercadante, Thomas F <NDATFM_at_labor.state.ny.us>
Date: Tue, 12 Jun 2001 05:35:36 -0700
Message-ID: <F001.003253C7.20010612054523@fatcity.com>

Rick,

I use surrogate keys when the obvious primary key value has the possibility of being updated by the application.

For example, you would think that a Social Security number might be a candidate for use as a primary key in a college database. What we found upon study is that, the Soc Sec # provided at college application time is sometimes the parents number, rather than the student's number. So, it changes about 10% of the time.

Of course, the cons of primary keys are that you probably will need an additional index on the table to allow lookup by a secondary value. In the above case, the primary key was a surrogate value supported by a sequence, with a secondary index on the soc-sec column. The cost of using the surrogate primary key was the additional index.

My current database that I am designing is only using surrogate keys. It provides a level of comfort in that we don't ever have to worry about the primary key being changed - it never will.

hope this helps.

Tom Mercadante
Oracle Certified Professional

-----Original Message-----
Sent: Tuesday, June 12, 2001 9:00 AM
To: Multiple recipients of list ORACLE-L

Hi All,

Can someone explain pros/cons to using surrogate keys(i.e.,sequences) vs non-surrogate keys?

Thanks
Rick
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Cale, Rick T (Richard)
  INET: RICHARD.T.CALE_at_saic.com

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: ListGuru_at_fatcity.com (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).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Mercadante, Thomas F
  INET: NDATFM_at_labor.state.ny.us
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: ListGuru_at_fatcity.com (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). Received on Tue Jun 12 2001 - 07:35:36 CDT

Original text of this message

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