I've a table X with a reference key of another table A. For a backup purpose I want to move the data from table A to table B. But while doing this, I've got the problem that the table X no more able to search entries in the table A and consistently returning a reference key error. Someone recommended me to remove foreign key from table X, but its not working. Can you suggest me a better solution?
According to the MySQL's official website, both tables must not be temporary tables. Related columns in the foreign key and the referenced key must have the same internal data type inside Database so that they can be compared without a type conversion.
Probably you need to include two foreign key constraints, it would then take a firm stand into the parent row exist in both tables. You just need to reference the ID of table X in table B and A.
__________________ "I'm not anti-social; I'm just not user friendly"
Technically it is possible. You just need to set two foreign keys for a table B and each foreign key need to point the required fields on one table. In simple words one foreign key per foreign table.