## DELETE Rule (delete_rule)

The DELETE rule (delete_rule) defines the effects that deleting a row in the referenced table (referenced_table) has on the referencing table.

### Syntax

<delete_rule> ::= ON DELETE CASCADE
| ON DELETE RESTRICT
| ON DELETE SET DEFAULT
| ON DELETE SET NULL

### Explanation

· No DELETE rule: deleting a row in the referenced table will fail if matching rows exist.

· ON DELETE CASCADE: if a row in the referenced table is deleted, all of the matching rows are deleted.

· ON DELETE RESTRICT: deleting a row in the referenced table will fails if matching rows exist.

· ON DELETE SET DEFAULT: if a row in the referenced table is deleted, the associated DEFAULT value is assigned to each referencing column for each matching row.
A DEFAULT specification must exist for each referencing column.

· ON DELETE SET NULL: if a row in the referenced table is deleted, a NULL value is assigned to each referencing column (referencing_column) of every matching row.
None of these referencing tables may be a NOT NULL column.

See also:

Referential CONSTRAINT Definition (referential_constraint_definition)

Column Attributes (column_attributes)