CASCADE

A foreign key action that deletes child rows automatically when their parent row is deleted.

A single delete can remove many dependent rows with no warning.

In more detail

Deleting one basket with ON DELETE CASCADE also deletes all its lines. That is right for parts that cannot exist alone and dangerous for valuable records, because one DELETE can silently remove far more rows than it names.

Example

basket_id INTEGER REFERENCES basket(id) ON DELETE CASCADE

Related terms

Taught in

References