skip to Main Content

enter image description here

enter image description here

I write this query ALTER TABLE com_product DROP COLUMN drug_id;
and
then write this query but also error

ALTER TABLE com_product DROP FOREIGN KEY drug_id;

but error

enter image description here

2

Answers


  1. You can not delete this column because it is the key of another table. There is a link between this 2 tables. You must take off this constraint first or empty your table.

    Login or Signup to reply.
  2. please remove your foreign key reference on column drug_id.

    ALTER TABLE com_product DROP FOREIGN KEY `com_product_ibfk_2`;
    

    Then remove the column.

    ALTER TABLE com_product DROP COLUMN drug_id
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search