MySQL Removing Some Foreign keys

前端 未结 11 660
太阳男子
太阳男子 2020-11-28 01:55

I have a table whose primary key is used in several other tables and has several foreign keys to other tables.

CREATE TABLE location (
   locationID INT NOT         


        
11条回答
  •  自闭症患者
    2020-11-28 02:30

    As explained here, seems the foreign key constraint has to be dropped by constraint name and not the index name. The syntax is:

    alter table footable drop foreign key fooconstraint
    

提交回复
热议问题