4 ms·
That's a 1:N relationship. There's nothing to prevent you from adding more related records. At the database level there's only one kind of foreign key. Yeah,
by petepete 4y ago
That's a 1:N relationship. There's nothing to prevent you from adding more related records.
At the database level there's only one kind of foreign key.
Yeah, you can try and prevent it from happening in code or throw some unique constraints at it, but it's unnecessary.
- crgwbr 4y agoIf the foreign key column is also that table’s primary key (or just has a unique constraint), then that’s not 1:N, it’s 1:1 or 1:0.
- petepete 4y agoYeah, I noted elsewhere among the replies it's possible to use constraints to prevent extra rows in the related table, but it's inelegant and I've seen plenty of cases where it's forgotten and ends up being buggy. I'd still advise people to follow the rules of normalisation unless there are very strong to deviate.