Kunok
Kunok

Reputation: 8759

Dropping tables with foreign key and dropping foreign key

I have tables with a lot of foreign keys and they mostly come in both ways, which makes it really hard to drop a table. This screenshot shows relations.

I want to drop match_teams table. It obviously say that I can't drop it due to foreign key. So I decided to drop foreign keys first with: alter table match_teams drop foreign key player_1 however it returns me error. (#1091 - Can't DROP 'player_1'; check that column/key exists )

What is the best way to drop such table and its foreign keys? What is wrong in my SQL statement?

enter image description here

Upvotes: 0

Views: 109

Answers (1)

Dazak
Dazak

Reputation: 1033

Verify the name of the foreing key and try deleting again...

The column's name is not necessary the same that the constraint's name.

Upvotes: 1

Related Questions