0

I am trying to learn working with SQL and I am coding in mysql workbench and I can't understand why the code in below doesn't work. It says it has a syntax error but I don't know where.

ALTER TABLE TABLE_ONE DROP FOREIGN KEY
jarlh
  • 42,561
  • 8
  • 45
  • 63
  • 4
    You have to specify which fk you want to drop. https://stackoverflow.com/questions/838354/mysql-removing-some-foreign-keys – jarlh May 13 '19 at 07:09
  • On a side note you may want to look at [How do i see all foreign keys on a table](https://stackoverflow.com/questions/201621/how-do-i-see-all-foreign-keys-to-a-table-or-column) if you're unsure of what foreign keys are on your specified table. – Matt May 13 '19 at 07:14

2 Answers2

3

Try this-

ALTER TABLE TABLE_ONE DROP FOREIGN KEY FK_Name
mkRabbani
  • 16,295
  • 2
  • 15
  • 24
2

You need to type the name of the specific foreign key to drop.

ALTER TABLE table_name DROP FOREIGN KEY id_name_fk;
Harvey
  • 572
  • 1
  • 7
  • 23