MySQL Removing Some Foreign keys

前端 未结 11 663
太阳男子
太阳男子 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:27

    The foreign keys are there to ensure data integrity, so you can't drop a column as long as it's part of a foreign key. You need to drop the key first.

    I would think the following query would do it:

    ALTER TABLE assignmentStuff DROP FOREIGN KEY assignmentIDX;
    

提交回复
热议问题