Drop foreign key constraints

Some times we have to drop the foreign key constraint that already exists, for that we have to first get the foreign key constraint name.
To see detailed description of created table we use following query.

Result of above query is

Here we can see that company_id column is referring company tables id field with the constraint name company_fk_id.

Now we have to drop this constraint for that we use ALTER TABLE as follows


Here fk_symbol is foreign key constraint used during table creation here we given company_fk_id. If not given then it is system generated value.

Again checking show create table

So we have successfully removed foreign key reference.