mySQL数据库--增加、删除、更改外键关联

来源:互联网 发布:雪梨网红淘宝店链接 编辑:程序博客网 时间:2024/05/24 05:22


删除外键关联

增加外键 关联


ALTER TABLE tblorder DROP FOREIGN KEY `FK_order_consignee_cityid`;ALTER TABLE tblorder ADD CONSTRAINT `FK_tblgtt_order_consignee_cityid` FOREIGN KEY(`consignee_cityid`) REFERENCES `tblcontact` (`cont_id`);
ALTER TABLE tblorder DROP FOREIGN KEY `FK_tblorder_shipper_cityid`;ALTER TABLE tblorder ADD CONSTRAINT `FK_tblorder_shipper_cityid` FOREIGN KEY(`shipper_cityid`) REFERENCES `tblcontact` (`cont_id`);


查了一下没有找到更改外键关联的命令,就使用傻办法,先删除后增加


0 0
原创粉丝点击