Share via


question of the evening...

I've seen something in a couple of different databases that kind of confuses me.  I've been looking through books on line to see if there's any advantage to it, but haven't been able to find anything...

What I'm seeing is multi primary key's in one table.  I can't really think of what the benefit of this would be...isn't the purpose of a primary key more or less to provide a unique identity for each record?  If that's the case, why would you ever need 2 unique identity's?

Has anyone else seen this done before?

Comments

  • Anonymous
    March 16, 2006
    What do you mean by multi primary key's?

    Because there is this thing you can do and that's making multiple attributes together the primary key (for example in a user table you could have firstname and lastname combine as your primary key)


    BTW: does your DBMS even allow multiple different (not combined) primary keys?

  • Anonymous
    March 16, 2006
    Hi,

    I are you sure that what you saw are tables with mutiple primary keys and not tables with primary keys made of multiple columns?

    The latter can be very useful, but I agree with you that I can't see how the former would be any good...

    Please post an example of what you saw, so I can ask the DB experts :)

  • Anonymous
    March 16, 2006
    It's probably how you guys explained it...now if an ID get's generated based on what the values in those other columns are, I can see the value of that...I'll have to check into this.  :)

    Thanks for shedding some light.

  • Anonymous
    March 17, 2006
    The comment has been removed

  • Anonymous
    July 09, 2008
    I have had reason to have multiple unique values in a table. One example is below: Part Master table (think products, in a distribution company) Unique ID (identity, maintained by the application) SKU - Unique identifier used by users. (the acronym stands for "Stock Keeping Unit") Both the Unique ID and the SKU must be unique. The SKU however, is subject to manipulation by the users. (for some reason they want to change the SKU - there are good reasons for this on occasion) You'd also want UPC to be unique in that situation, although I've seen UPCs reused in the past - NOT a pretty sight.

  • Anonymous
    June 08, 2009
    PingBack from http://insomniacuresite.info/story.php?id=1630