Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Simple table design question

Author  Topic 

Jacmac
Starting Member

11 Posts

Posted - 2010-02-05 : 17:27:42
I've got a table of assets and a table of contacts. An asset may have a variable number of contacts associated with it. How should the asset table be designed to store contacts?

Because of my programming experience, my thought process is that I'm attempting to store a variable sized 'list' of foreign keys in a column.

Kristen
Test

22859 Posts

Posted - 2010-02-06 : 01:09:50
I would just a third "link" table that joins Assets and Contacts. It only needs two columns - the Asset.ID and the Contact.ID (although you might add others - IsActive, DateCreated, that sort of thing.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-02-06 : 06:33:13
A variable sized list of foreign keys contradicts relational principles. Also the thrid table option outlined will allow easier application of set based queries

Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

Jacmac
Starting Member

11 Posts

Posted - 2010-02-06 : 15:53:01
Yes can I see that the third table makes sense, thanks for the answer.
Go to Top of Page
   

- Advertisement -