Relationship Doubts in Mysql Workbench

Asked

Viewed 799 times

4

I am new to the forum and I count on your help in an issue that occurs in Mysql Workbench.

inserir a descrição da imagem aqui

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, the Workbench generates in this table that is being related to the foreign keys of the previous table. Like in the model above, the Address table pulled the relationship from Pessoa/Funcionário. Could you help me in this matter?

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

Thanks in advance.

2 answers

7


You are setting the column Pessoa_idPessoa table Funcionario, as Primary key, just remove it and redo the interface to solve your problem. Solução para o Problema

  • Vlw Vitor. ?

  • Normally Workbench automatically sets Primary Key to only id’s, I can’t tell you what might be going on with the foreign key itself... )...

  • Has some version that contains in table configs the option foreingn Keys?

  • I don’t understand your question. Foreign key (Foreign key) is the field that establishes the relationship between two tables.

  • Yes, sorry, I wanted to talk about an option you define as a foreign key. Type, each time I relate, I will have to disable the primary key?

  • Bro, I figured out what makes this foreign key issue go to the next related table. My vacillation on the keys on the ligament identified with the unidentified ones. Now it will work here, Thank you so much for your help.

  • Denada, need we are there... ^^

Show 2 more comments

0

Good afternoon the relationship is incorrect.

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

So it becomes simple to solve your problem.

Employee is a person so we are adding a daughter class to the parent Person class. Ids have to have the same value. It is not necessary for you to add a person within the class who inherits from person in the employee case.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.