I am studying Computer Science, and recently in the exam, I had the following question:
“Write the SQL query creating this ER model.”
The model has three (3) tables: person
, library
, and the third table contains two foreign keys linked respectively on person's id
and library's id
.
In the middle table (the foreign keys one), it wasn't indicated if the foreign keys were making the primary so I asked him to make sure, and he told me this table had no primary key.
That left me confused, and refused to explain more, and just said “it works without a primary key, we saw this in class.”
Because the model was a capture from phpmyadmin's designer view and because he didn't really justified. I feel suspicious toward this and I think he tried it, and that MySQL let him do it but that is wrong. Can someone explain this better? I'm totally fine with being wrong, I just want to know.
To make it a bit clearer, he precised that there was no primary key at all and not just the two foreign key together like I thought.