What is the correct type for storing phone and address? [duplicate]

0

As the title says, what is the correct type and the correct way to store phone and address, according to database normalization ?

  • In the case of telephone, what is the correct type to store, the landline and cell phone? With formatting mask or not?
  • And in case of address, how to store it? In several other fields, such as street, neighborhood, number and city, or all in one / two only?
asked by anonymous 29.09.2017 / 15:49

1 answer

0

In the case of phone , what is the correct type to store, landline and cell phone? With formatting mask or not?

It varies from programmer to programmer, but in my case I always do with masking formatting to make it easier to read the data or even return it. On the storage I usually create Two tabelas one for fixed and another for cel and I use chave estrangeira of the user to be able to link.

And in the case of address, how to store it? In several other fields, such as street, neighborhood, number and city, or all in one / two only?

For this one I like to do the following architecture

Notice that I'm breaking up each address field into a table. And when it comes to putting everything together I use inner join .

obs: I used a clear example that you can put up to ZIP code, add-on etc.

    
29.09.2017 / 16:00