2

I have three entities :

Technician
Vehicle
Repair

The question is how to model this in ERD? Knowing that a technician can repair multiple cars, and the same car can be repaired by one and only one technician? How should the repair entity tied to all this?

  • Would this be better asked on dba.stackexchange.com/questions ? If so, ask a moderator to migrate this question for you. – FrustratedWithFormsDesigner Nov 5 '12 at 19:21
  • 1
    What is the repair entity? so far you haven't described what it actually is, you seem to understand the relationship between technician and vehicle in both directions. – Ryathal Nov 5 '12 at 19:31
7

You need to specify more description of your tables and of your requirements. Anyway, here is one way to model the tables. However, in a real application there would be other things to consider. Only PKs and FKs are shown. Other columns depend on your case.

Note: In the original version of the answer, I missed the requirement that "the same car can be repaired by one and only one technician". To implement this, in the Repair_Job table, the TechID column + VIN column should be constrained to be unique.

enter image description here

  • 1
    Does this ensure that a vehicle is always repaired by the same technician, as asked by OP? – Manuel Lafond Mar 15 at 19:08
  • @ManuelLafond, Good point. I missed that requirement! Please check the updated solution. Thanks for pointing this out. – NoChance Mar 15 at 21:04
3

CONCEPTUAL

CONCEPTUAL

Note that in the ERD ( conceptual data model ) you don't specify the foreign keys, they are implicit in the relationship ( lines ).

Your data modeling tool will generate the foreing keys for you when you generate the physical data model (RDBMS dependant):

PHYSICAL

PHYSICAL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.