3
Good night.
I have the following question in relation N to N. Foreign keys become a primary key composed of the associative table. Correct?
Does this guarantee that there is no repetition between the tuples? Because I think even if they make up the primary key there can be repetition, so I suppose to add another primary key field to ensure integrity (func_projectoID). Or my thinking is wrong?
This is exactly what is done in a real system. Only composite key is not always used. In theory, in modeling, you can present this idea that you will pass without errors. But in implementation, what you see is a
pk
func_projectoID, a columnfk
func_id and otherfk
project_id. Anyway, your thinking is correct.– Andrew Ribeiro
Thank you very much for the clarification!
– Leonardo
@Andrewribeiro Write an answer, please.
– Not The Real Hemingway
@Leonardo +1, but please write a more meaningful title. Your question is excellent. Database modeling is perhaps the most important part of a software project. I’m still surprised we don’t have so many questions about that. We need to document the questions and answers well, because they will surely serve people who had the same question.
– Not The Real Hemingway