It’s widely understood among SQL Server developers that foreign keys can prevent us from deleting a row from the parent table if there’s child table that references the key in that row.
But did you know that we can specify a different course of action in such cases?
For example, we could configure our foreign key to delete the child as well. Or we could set it to NULL, or to its default value.
These options are all available, thanks to the ON DELETE clause.