Post by c***@hotmail.comIf I did not define a cascade delete on the child referential constraint.
When delete parent record, will it delete related child record
automatically?
What is the default value? of referential constraint?
Thanks.
If there is a foreign key on a child table defined as "on delete restrict"
or "on delete no action" pointing back to a parent table, and you try delete
a row on the parent table that has a corresponding value on one or more rows
on the child table, you will get an error and the delete will fail. To
automatically delete the children rows when the parent is deleted, the FK
constraint must be defined as "delete cascade".
The default is "no action", but it is very similar to restrict and only
affects the timing of the check in certain situations:
"A delete or update rule of RESTRICT is enforced before all other
constraints, including those referential constraints with modifying rules
such as CASCADE or SET NULL. A delete or update rule of NO ACTION is
enforced after other referential constraints."