Database Design Composite Keys
Posted
by guazz
on Stack Overflow
See other posts from Stack Overflow
or by guazz
Published on 2010-04-27T21:49:18Z
Indexed on
2010/04/27
21:53 UTC
Read the original article
Hit count: 395
I am going to use a contrived example: one headquarter has one-or-many contacts. A contact can only belong to one headquarter.
TableName = Headquarter
Column 0 = Id : Guid [PK]
Column 1 = Name : nvarchar(100)
Column 2 = IsAnotherAttribute: bool
TableName = ContactInformation
Column 0 = Id : Guid [PK]
Column 1 = HeadquarterId: Guid [FK]
Column 2 = AddressLine1
COlumn 3 = AddressLine2
Column 4 = AddressLine3
I would like some help setting the table primary keys and foreign keys here?
How does the above look?
Should I use a composite key for ContactInformation on [Column 0 and Column1]?
Is it ok to use surrogate key all of the time?
© Stack Overflow or respective owner