It is possible with some agreements in your data. To maintain child table data you'll have to do ON DELETE SET NULL
. This will leave data, but set FK to NULL
value (in child table). And that is because of data-integrity: while you can keep your data, your FK can not refer to non-existent row of parent table in terms of enforcing FK
constraint. Thus, it will be set to NULL
by this.
If you want to "save" value of FK - then you definitely should not use FK at all because such behavior violates what FK is. So then just don't use that constraint, but be aware of possible integrity fails.