MySql WorkBench Relationship Doubts

3

I'm new to the forum and can count on your help on a MySql Workbench issue.

I did a little modeling to explain my doubt. I would like to understand why, when relating a table that already has a foreign key, WorkBench generates in that table the foreign keys of the previous table are being related. Same as in the above model, the Address table pulled the Pessoa/Funcionário relationship. Could you help me with this?

NOTE: This modeling was only to show the question in question.

Thank you in advance.

    
asked by anonymous 08.11.2016 / 23:14

2 answers

7

Hello, how are you?

You are setting the Pessoa_idPessoa column of the Funcionario table, as Primary key , so that your problem is solved by simply removing it and redoing the relationship to solve your problem.

    
08.11.2016 / 23:27
0

Good afternoon the relationship is incorrect.

Ask yourself if an employee is a person or employee has one person.

So it's easy to solve your problem.

Employee is a person so we are adding a child class to the parent class Person. Ids must have the same value. You do not need to add a person within the class that inherits from the person in the employee case.

    
28.11.2016 / 21:58