My instructor has asked us to DELETE a row from a referenced table. The question is: Delete operator 4. Don't forget referential integrity, but do not delete any trips or vehicles.
我的讲师要求我们从引用的表中删除一行。问题是:删除操作员4.不要忘记参照完整性,但不要删除任何旅行或车辆。
I understand cascade delete and referential integrity but cannot wrap my mind around this. To clarify, I know that Cascade delete would allow for the removal of the operator but would also delete the trips. He does not want the trips or any other referencing table to change.
我理解级联删除和参照完整性,但无法解决这个问题。为了澄清,我知道Cascade删除将允许删除运营商,但也会删除旅行。他不希望旅行或任何其他引用表发生变化。
I though it might be a trick question and just make all the fields of Operator 4 Null but they require a value so that's a no go.
我虽然这可能是一个技巧问题,只是让运算符4的所有字段为空,但它们需要一个值,所以这是一个不行。
Operator 4 is referenced by a table named Runs. The Runs table is referenced by a table named Schedule. The Schedule table is referenced by a table named Trips.
运算符4由名为Runs的表引用。 Runs表由名为Schedule的表引用。 Schedule表由名为Trips的表引用。
How can I DELETE operator 4 while maintaining referential integrity or is there an angle I'm not looking at it from.
如何在保持参照完整性的同时删除运算符4,或者是否有一个角度我没有从中查看它。
Thank you in advance.
先感谢您。
1 个解决方案
#1
If FK cols are nullable, you can set them to null and delete the former referenced records.
如果FK cols可以为空,则可以将它们设置为null并删除以前引用的记录。
#1
If FK cols are nullable, you can set them to null and delete the former referenced records.
如果FK cols可以为空,则可以将它们设置为null并删除以前引用的记录。