sql语句格式:
· 添加外键约束:alter table 从表 add constraint 外键(形如:FK_从表_主表) foreign key (从表外键字段) references 主表(主键字段);
如果mysql报错:Error Code: 1215. Cannot add foreign key constraint (foreign keys)
检查 主从表两个字段的属性是否一致
参考:Error Code: 1215. Cannot add foreign key constraint (foreign
keys)
来源:CSDN
作者:const伐伐
链接:https://blog.csdn.net/u013905744/article/details/71403045