Learn VisualLearn DB Visual
JA

Decide What a Parent Delete Means

ON DELETE defines how deleting a parent affects referencing rows — for example, what happens to an order's line items (order_items) when the order itself is deleted. PostgreSQL defaults to NO ACTION. RESTRICT refuses the delete, CASCADE deletes the children too, and SET NULL removes the reference when the child column permits NULL.

Why is SET NULL invalid for a NOT NULL foreign-key column?