Can a foreign key be part of more than one table?

Asked

Viewed 546 times

0

inserir a descrição da imagem aqui

I wonder if I can put a foreign key in more than one table, for example, where the entity "competitors" in the image is a table and the attribute "id_competitor" is a primary key, and the other entities "competitors" document, "competitors", "competitions_contact" and "competitions_placement" have as a foreign key the "id_competitor", would it be possible to do so? If not what better option to do?

  • 1

    Each of them should have a FK (Foreign Key) related to the competitor. There’s nothing wrong with that.

1 answer

2


  • The table can also have as attribute only a primary key ?

  • Yes. But a primary key can be formed by more than one column, so it becomes one composite primary key. Read one about it at this link: http://www.luis.blog.br/chave-primaria-simples-e-chave-primaria-composta.aspx

Browser other questions tagged

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