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
 New to SQL Server Programming
 table design

Author  Topic 

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2006-02-13 : 04:32:02
Hi am trying to figure out my table design need some advice

I have a table that catches the telephone numbers of a customer , there are 5 telephones for each customer. All the numbers are there in the DB

Should I create the design in the following format

CustomerName
Tel1
Tel2
Tel3
Tel4
Tel5

Or Should I have

Customer
Telephone

& then have 5 rows for each customer

Please advice


I even wanted to knw how should the design be , if all the Tel Nos are not captured, I mean what if some customers have 3 tel Nos, while some may just have 1 while some may have all 5

Thanks


jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-02-13 : 04:35:34
2nd option,

i think, a join is faster than parsing an n-length of field



--------------------
keeping it simple...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-13 : 04:39:49
Second is according to Normalisation

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-13 : 05:48:56
Second option is the best and it conforms to normalization and does not limit the number of telephone no per customer to 5. And it is much more flexible in your design. If in future you need to identify the type of telephone no (like Mobile No, Work No, Home No etc) you can just easily add a column to identify it.

quote:
I even wanted to knw how should the design be , if all the Tel Nos are not captured, I mean what if some customers have 3 tel Nos, while some may just have 1 while some may have all 5

The Second option will not have any issue with this.

----------------------------------
'KH'

everything that has a beginning has an end
Go to Top of Page

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2006-02-13 : 05:55:57
Any comments on space management
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-13 : 07:19:32
Did you mean column size?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2006-02-13 : 08:25:23
Sorry that was a wrong question, wouldnt the joins eat up a lot of resources in the fututre, I mean fetching data from one table would be much simpler

What say
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-02-13 : 08:32:57
Properly indexed, joins would not slow the process down or use a lot of resources. SQL Server is designed to work with sets, so it's natural for it to deal with data in this format.
Go to Top of Page
   

- Advertisement -