Thursday, 20 April 2017

foreign keys - How to remove constraints from my MySQL table?



I want to remove constraints from my table. My query is:



ALTER TABLE `tbl_magazine_issue` 

DROP CONSTRAINT `FK_tbl_magazine_issue_mst_users`


But I got an error:




#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint FK_tbl_magazine_issue_mst_users' at line 1



Answer



Mysql has a special syntax for dropping foreign key constraints:




ALTER TABLE tbl_magazine_issue
DROP FOREIGN KEY FK_tbl_magazine_issue_mst_users

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...