Database Design – Resolving Many-to-Many Relationship in ERD

database-designerd

The case study states "each car belongs to a car type" and "each mechanic specializes in a car type or many car types".

My current entity type definitions:

  • Car
  • CarType
  • Mechanic

My Entity-Relationship Diagram so far:

Car        1-----0..*   CarType
CarType 0..*-----1      Mechanic
Car     0..*-------0..* Mechanic

As stated in the title, I am attempting to resolve a possible many to many relationship.

Best Answer

I'm not sure I entirely understand your question as it could be better structured, is this the structure you are looking for?

A CarType can have many cars BUT a car can only have one CarType. 1-to-many

A Mechanic can specialise in many CarTypes AND a CarType can have many Mechanics specialise in it. many-to-many

A mechanic can then work on multiple cars BUT a car can only be worked on by 1 mechanic. 1-to-many

So when implementing the structure will look something like this: enter image description here

Hope this is of help, apologies if i haven't answered what you are looking for.