Skip to content
Advertisement

cannot drop a foreign key in mySQL

It’s a common example between Persons and Orders. I just copied it from Internet as a test.

Till now it’s all successful. But how can I drop the Foreign Key PersonID?

I tried this.

MySQL said:

1091 – Can’t DROP ‘PersonID’; check that column/key exists

Advertisement

Answer

Identify the name of the constraint using the statement:

Use the result from CONSTRAINT_NAME in your ALTER TABLE statement. For example:

Answer derived from the MySQL Reference Manual

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement