Common Phone table serving two other tables

Reply

Join Date: Jan 2009
Posts: 1
Reputation: kidego32 is an unknown quantity at this point 
Solved Threads: 0
kidego32 kidego32 is offline Offline
Newbie Poster

Common Phone table serving two other tables

 
0
  #1
Jan 9th, 2009
Hi all,

I have a customer table. Each customer can have multiple contacts, as well as multiple phone numbers. Each contact can also have multiple phone numbers.

My design right now is as follows:

customer table:
cust_id
cust_name
cust_address
...

customer contact table
cust_contact_id
cust_id (fk) -> refers to customer table's cust_id
cust_contact_name
...

At this point, I thought of using one phone table to store both customer and contact phone numbers, but I can't figure out how to link them ... A customer can have zero, one or many phone numbers. A contact also can have zero, one or many phone numbers.

Then only way I can think of doing it is by having two phone tables:

customer_phone_table
phone_id
cust_id (fk)
phone
phone_ext

contact_phone_table
phone_id
cust_contact_id (fk)
phone
phone_ext

Is there a better solution that I'm missing?

Thanks
Julio
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 10
Reputation: j.kelly is an unknown quantity at this point 
Solved Threads: 0
j.kelly j.kelly is offline Offline
Newbie Poster

Re: Common Phone table serving two other tables

 
0
  #2
Jan 11th, 2009
Hi Julio,

Another way would be to have a single phone number table with two FKs (cust_id & cust_contact_id). Only one FK would be used for each phone number record.

James
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Common Phone table serving two other tables

 
0
  #3
Jan 11th, 2009
I've attached my draft...if anything not clear reply...
Attached Thumbnails
scan.jpg  
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Database Design Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC