I have a database design question.
In my application, a user has contact information including
- telephone number
- adress line 1
- postal box
- Locality (City)
This is currentl located in a “user” table with the other informations like username, first name, …
The thing is that a user has to have the same kind of information (telephone, email, …) but for his company.
It seems redundant to add additional fields to the “user” table. As the data are similar, I could make a “ContactInfo” table with the fields:
- phone
- address
- postal box
- …
Is it a good idea and how should I do the relation between the “user” table and this “contactInfo” table ?
EDIT: I forgot to say that the company contact information is not obligatory. A user can have no company at all.
Separate tables are the right choice.
If your database supports foreign keys, there should be a foreign key from
user_contact_info.user_idtousers.id.user_contact_info.contact_typewould be set toworkorhomeor whatever other categories you need.