MySQL Generator

Here you can get the mysql structure for add/drop Foreign Key in table.

Foreign Key Table Structure

Query Output:

CopiedCopy Code

ALTER TABLE <table_name> ADD CONSTRAINT <contraint_name> FOREIGN KEY(<field name>) REFERENCES <Reference_table_name>(<ReferenceFieldName>);


Drop Foreign Key Table Structure

Query Output:

CopiedCopy Code

ALTER TABLE <table_name> DROP INDEX <field_name>;