Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, James.

Asked: May 24, 2004 - 12:20 pm UTC

Last updated: May 24, 2004 - 12:20 pm UTC

Version: 9i

Viewed 1000+ times

You Asked

Are there guidelines for when a table should use an intelligent key as opposed to a system generated (non-intelligent) key? For example: should a product table use the product-id as the key or a system generated key?

Thanks
James



and Tom said...

The rule is

o if something has a natural key that is imutable, by all means use it.

o if something doesn't have a natural, imutable key, use a surrogate (i don't like "non-intelligent", what is "dumb" about it??)


If product ID is never changing (if you can reasonably expect it to be imutable), use it.

PRODUCT_ID -- probably good key
PRODUCT_NAME -- probably not a good key.

Else, develop a surrogate key.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, February 02, 2025 - 10:35 pm UTC


A reader, February 02, 2025 - 10:37 pm UTC