Relational database for address model I want to design an &quot;Address&quot; model for all types of entities like users, businesses, etc.
I have two types of main models: one is User and the other is Business. Each one has different address types like below.
User
1.Contact Address
2.Billing Address

Business
1.Contact Address
2.something

So I created an address model with an addresstype column like this
Address
id
addresstype
user
addressline1
addressline2

Relationships:

User – One to many –&gt; Business
User – One to many –&gt; Address (User Column)

Now using the above relations, addresstype and user columns will be in a relation, but Business address is not relatted with address.
How can I design this one in an efficient way?
Here's what we did in LedgerSMB:


Entity table storing basic container info on individuals and businesses
location table storing address information.
Right now we have a join table between address and entity, but in future versions that will probably be merged with the address table.
Tables 'person' and 'company' which extend entity for that purpose.


That basic structure would work on MySQL too.  On PostgreSQL we do some magic with partial unique indexes to make sure that billing addresses are unique per entity, but contact addresses are not.  This would not be possible to enforce in MySQL as easily though it could be done with creative design.