glgcag1991
Programmer
I have a Clients table and a Vendors table, both of which I need to connect to an Addresses table through an associate table for a many to many relationship. So, rather than having to create two associate tables (t_Clients_Addresses & t_Vendors_Addresses) I would like to create t_Contacts_Addresses to link both Clients and Vendors tables to Addresses table- the associate table fields would look as follows:
pk_Contacts_AddressID
fk_Clients_ClientID
fk_Vendors_VendorID
If the address corresponds to a vendor, the vendor fk will exist, if it corresponds to a client, the client fk will exist. This way, if a client and vendor share the same address, I can reuse it.
I've always created separate associate tables for many to many relationships, but in this case, it seems to work having one table to handle both Clients and Vendors. Is this efficient and a good way to handle it, or should I do it differently? Thanks for the help and suggestions!
pk_Contacts_AddressID
fk_Clients_ClientID
fk_Vendors_VendorID
If the address corresponds to a vendor, the vendor fk will exist, if it corresponds to a client, the client fk will exist. This way, if a client and vendor share the same address, I can reuse it.
I've always created separate associate tables for many to many relationships, but in this case, it seems to work having one table to handle both Clients and Vendors. Is this efficient and a good way to handle it, or should I do it differently? Thanks for the help and suggestions!