Can't Drop foreign key in MySQL

后端 未结 7 646
粉色の甜心
粉色の甜心 2020-12-04 19:37

I have had a 1 to many relationship between course and instructor, which I wanted to drop. When I tried to drop the instructorID in course table it told me that. I couldn\'t

7条回答
  •  星月不相逢
    2020-12-04 20:24

    After you run SHOW CREATE table course; you should find the fk symbol which is commonly like the one bellow:

    (course_ibfk_1) 
    

    it may differ according to your mysql version you are using then drop the foreign key using the fk symbol as follow :

    alter table course drop foreign key course_ibfk_1;
    

提交回复
热议问题