× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> wrote on 07/27/2019
01:23:04 PM:
This is interesting and maybe a database expert will chime in, but I've
always thought of the identity key, the one assigned by the database, as

the surrogate key. The customer number (in this thread) is the natural
key, or business key, and is the primary key and it must be unique.


The answer is that it depends upon how you define it. But,
generally, an identity column usually has the following constraint
accompanying it. This makes it the primary key. This key cannot be
changed without a delete and re-add.

Alter Table ... Add Constraint ... Primary Key ...;


After that, a company number, customer number, item number, etc.,
might have the following constraint associated with it. This makes it a
"surrogate" key and can be changed without having to delete and re-add the
row.

Alter Table ... Add Constraint ... Unique ...;


Lastly, there is a foreign key that might be used to avoid
carrying things like hard-coded category codes in a company row, customer
row, item row, etc. A separate table (usually refered to as a "lookup"
table) would be used to carry the codes as surrogate keys and have an
identity (primary) key that is carried in the tables referencing these
codes.

Alter Table ... Add Constraint ... Foreign Key ...;


Sincerely,

Dave Clark

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.