How can I relate a table (entity) to more than one entity in the MySQL database? following the following example ...
I have the tables: fornecedores
, clientes
and telefones
.
-
fornecedores
, may have more than one phone. -
clientes
, can also have more than one phone.
To solve this problem, I created a N:N
relationship, where fornecedor
can have multiple telefones
, but a phone does not belong to several fornecedores
. This is equal to clientes
, where a client can have multiple telefones
, but a phone does not belong to several clientes
.
With this relationship N: N, we created an intermediate table between fornecedores
and telefones
, and also between clientes
and telefones
.
How could I solve this problem, without having to have a telephone table to relate to fornecedores
, and another phone table to relate to clientes
? without being N:N
?