Hi,
I have 2 mysql tables in my database.
One table I have insurance types (ie Pet insurance, Motor Insurance etc)
And in the other table I have Insurance Company profiles.
Now an insurance company may be able to provide more than one type of insurance so I want to be able to reference more than one insurance type to a companies profiles.
Can anyone think of a method to do this?? I'm thinking along the lines of adding each insurance type's id to that company's profile but thats where i'm stuck.
Many thanks
Will
Looking for a solution... please help
Moderator: General Moderators
this is a classic example of many-to-many relation. Such a link in relational databases is expressed using additional table which maps company to its services/products:
Here Microsoft offers only software, Intel offers only hardware while IBM offers both (thus it has two rows in Company_Service table
Code: Select all
Company:
id | name
----------------
1 | Microsoft
2 | IBM
3 | Intel
Service:
id | name
----------------
1 | Software
2 | Hardware
Company_Service:
id | company_id | service_id
------------------------------------
1 | 1 | 1
1 | 2 | 1
1 | 2 | 2
1 | 3 | 2