使用圆形外键从两个表中删除

问题描述:

我有两个桌子

TableOne (TABLE_ONE_ID (pk), TABLE_TWO_ID (fk), ...(something else) )
TableTwo (TABLE_TWO_ID (pk), TABLE_ONE_ID (fk), ...(something else) )

如何从这些表中删除记录?

How can I delete records from these tables?

P.S.我认为这是错误的设计,但这不是我的错,并且我没有更改数据库结构的权限.我只需要知道如何从这些表中删除记录即可.

P.S. I think that it is bad design, but this is not my fault and I don't have permission to change the database structure. I just need to know how to delete records from these tables.

我不确定实现此目的的最佳方法,但我可能会做类似的事情:

I'm not sure of the best way to go about this but I would probably do something like:

UPDATE TableOne SET TABLE_TWO_ID = null;
DELETE FROM TableTwo;
DELETE FROM TableOne;