I have two MySQL tables: collections
and privacy_level
.
I define them with a foreign key relationship as such:
ON DELETE RESTRICT
means you can't delete a given parent row if a child row exists that references the value for that parent row. If the parent row has no referencing child rows, then you can delete that parent row.
ON DELETE RESTRICT
is pretty much superfluous syntax, because this is the default behavior for a foreign key anyway.