Kristian wrote:
Hello,
Let's say I have a table that contains three foreign keys to other tables in the database. Together, all three could uniquely identify the row. Is it better practice to make those three columns the primary key, or leave them as foreign keys and add an identity column?
Thanks!
As WvNoort says, it can be both, depends on what you like. There is no rule for this, one camp says: "one PK field per table/entity!", while the other camp (admitted, I'm that camp
) says: "one PK field per entity, unless the entity is an objectified relation, then the entity should be identified by the combination of the FKs. ". But it's a pure semantical issue, they both have advantages and disadvantages.