Why does an error occur if I delete the foreign key from the beginning from the child, and then the primary from the parent table?
ALTER TABLE `docher` DROP FOREIGN KEY `id`; ALTER TABLE rodit DROP primary key;
Why does an error occur if I delete the foreign key from the beginning from the child, and then the primary from the parent table?
ALTER TABLE `docher` DROP FOREIGN KEY `id`; ALTER TABLE rodit DROP primary key;
It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:
A foreign key can usually only be deleted if it is not used, i.e. if there are no records to which it refers. If you want to nail the key, without losing the data, then you need to duplicate the column first, then transfer the data from the key column to it, then reset the keys, and then nail the foreign key. Something like this.
Source: https://ru.stackoverflow.com/questions/113859/
All Articles