![]() ![]() If default values do not exist, an error is produced. Similar to SET NULL, but the foreign key columns were set to their default values. SET NULL: The change is allowed, and the child row's foreign key columns are set to NULL.For example, if a parent row is deleted, the child row is also deleted if a parent row's ID changes, the child row's ID will also change. CASCADE: The change is allowed and propagates on the child table.This is the default behavior for both ON DELETE and ON UPDATE. The statement terminates with a 1451 error ( SQLSTATE '2300'). RESTRICT: The change on the parent table is prevented.The allowed actions for ON DELETE and ON UPDATE are: A TRUNCATE TABLE against a table containing one or more foreign keys is executed as a DELETE without WHERE, so that the foreign keys are enforced for each row. ![]() Trying to drop a table that is referenced by a foreign key produces a 1217 error ( SQLSTATE '23000').When a value in the column referenced by a foreign key changes and at least one child row exists, MariaDB performs an action which depends on the ON UPDATE clause of the foreign key.When a row in the parent table is deleted and at least one child row exists, MariaDB performs an action which depends on the ON DELETE clause of the foreign key. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |