Phone number location question
-
I would like to know what people do with phone numbers when storing them for an app. I have several ideas and I have implemented most of them depending on the app, but I want to get to a standard so I'm asking the question: Where do you store phone numbers for your app? Assuming I have a Clients table and Contacts table I have done the following in the past: 1. Created fields in both tables for each row such as Phone1, Phone2... 2. Created a seperate table phone numbers and created a reference table to hold the ids of the clinet/contact and the phone number. 3. Created a text field in both tables and stored the phone numbers as and XML string I know that creating other tables and ref tables is probably the best Normalized way to do this but is it really that much of a memory/time savings over just storing the information in the same table as the Clients/Contact? Any thoughts would be appreciated, Richard
-
I would like to know what people do with phone numbers when storing them for an app. I have several ideas and I have implemented most of them depending on the app, but I want to get to a standard so I'm asking the question: Where do you store phone numbers for your app? Assuming I have a Clients table and Contacts table I have done the following in the past: 1. Created fields in both tables for each row such as Phone1, Phone2... 2. Created a seperate table phone numbers and created a reference table to hold the ids of the clinet/contact and the phone number. 3. Created a text field in both tables and stored the phone numbers as and XML string I know that creating other tables and ref tables is probably the best Normalized way to do this but is it really that much of a memory/time savings over just storing the information in the same table as the Clients/Contact? Any thoughts would be appreciated, Richard
It really depends on what you are going to do with the information. If all that will ever happen is that the phone number gets displayed on the screen for a customer services person to see and then dial the number then having phone1, phone2 etc. is probably fine. If you are storing more than just the phone number you might consider normalising it. e.g. for each phone number you are going to put what type of number it is (work, home, mobile, fax, etc.) and maybe a description, e.g. "Available between 9:00 and 18:00" Alternatively, if you are going to do any serious processing with phone numbers (and I really can't imagine what that could be outside of a telco or automated call centre scenario) then you would be better normalising the data otherwise the SQL will get horrendous. ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?