New answers tagged foreign-key
0
votes
How to handle the deletion of records with "shared ownership"?
I think I agree with @Charlieface
In a real world scenario (and from my personal experience) you can easily delete when thy are single tenant but it gets messy in a multi tenant scenario.
And in my ...
2
votes
Issues with Self-Referencing Foreign Key in SQLite
Your code is correct, but as Alexander Patrov explained in the comments, you have to enable foreing key constraints each time you connect to the database.
Dbfiddle
Top 50 recent answers are included
Related Tags
foreign-key × 1014mysql × 317
database-design × 225
postgresql × 215
sql-server × 187
primary-key × 124
constraint × 107
referential-integrity × 45
innodb × 44
oracle × 41
index × 38
performance × 36
delete × 36
join × 34
mariadb × 32
relational-theory × 32
trigger × 26
sqlite × 25
cascade × 25
normalization × 23
unique-constraint × 23
insert × 22
table × 21
schema × 20
sql-server-2008-r2 × 18