0
Отвечен

Artificial primary keys in many-to-many relationships

Sergio González (IT teacher) 4 года назад обновлен Adam Mościcki 4 года назад 1

Checking your article "A Dating App Data Model" I saw that in relations that appear from a many-to-many relationship (for instance between relations "user_account" and "gender") you add an artificial primary key (in the case exposed, primary key is a numeric field "id" but the primary key should be the combination of "user_account_id" and "gender_id").

Is there a technical reason to do that?

ХОРОШО, МНЕ ПОНРАВИЛОСЬ

Thanks for the answer!

Оценка удовлетворенности от Sergio González (IT teacher) 4 года назад
Отвечен

Hello Sergio,

You are right, the primary key is an artifical (surrogate) primary key.

To be honest, I don't know the reason. 

The best way to get the answer is to ask directly in the article: https://www.vertabelo.com/blog/a-dating-app-data-model/

Hope this helps,

Adam

Сервис поддержки клиентов работает на платформе UserEcho