mysql出现Cannot add foreign key constraint原因

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/birduncle/article/details/68936122

题目详解:

MySQL Workbench进行数据库建表增添字段的时候,会有这些选项,这些选项的意义如下:

PK Belongs to primary key 作为主键

NN Not Null 非空

UQ Unique index 不能重复

BIN Is binary column 存放二进制数据的列

UN Unsigned data type 无符号数据类型(需要整数形数据)

ZF Fill up values for that column with 0's if it is numeric 填充0位(例如指定3位小数,整数18就会变成18.000)

AI Auto Incremental 自增长

出现Cannot add foreign key constraint原因:

1.外键属性与关联字段属性不一致

2.外键所在表中相对应字段的ZF属性被设置


猜你喜欢

转载自blog.csdn.net/birduncle/article/details/68936122
今日推荐