postgresql - sql database model for contact details -


I need a DB to store, that means user records. Regular accessories: Name, e-mail, address, phone, fax and so on. The problem is that in this case more than one phone number per user can be. And more than one e-mail in more than one address and a lot more than one of the stuff

One way is to store everything in one table, e.g. Serialized Phone Array in a Phone Column Or a phone call separate from a comma, but I really do not like it in this way, I want to make more database to simplify programming logic in another way.

Individual table for another phone, personal table for address and so on: Column: ID , customer_id , phone < / Strong>. customer_id context customer . id Now it looks like a real slip, in which approximately 10 tables are for contact details to be stored.

And I have another idea, such as id , customer_id (& lt; -reren key), key , Value . Where the key can be "phone" and the value is "+ 1233435454", or the key "e-mail" and the value ... you got this idea. So far I like this best.

What would you suggest? What will be the downsides of the # 3 method?

DB I'm going to use postgresql , but it does not really make any difference.

Some men say that there are no 3 ways to go. Actually using that approach, you can theoretically create a single table database!

Although GBN has been mentioned, it will create problems with specific formats, and you only need to apply data length to the client and so on.

ID number addrss_type varchar (home / p / p)

I will go with my second suggestion and with various tables, an address type, phone number type etc., Contact / mail etc.) addrs_line1 varchar addrs_line2 varchar etc, etc.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -