mysql 150 错误

您所在的位置:网站首页 ug报错150 mysql 150 错误

mysql 150 错误

2024-02-22 01:09| 来源: 网络整理| 查看: 265

create table t_sells(     -> selid int primary key comment '销售编号',     -> proid int comment '商品编号',     -> seldate datetime not null comment '销售日期',     -> selcount int not null comment '销售数量',     -> selprice int not null comment '销售价格',     -> cusid int comment '客户编号',     -> constraint fk_8 foreign key(proid) references t_product(proid),     -> constraint fk_9 foreign key(cusid) references t_customer(cusid)     -> );1005 - Can't create table 'homework.t_sells' (errno: 150)

 

在mysql 中建立引用约束的时候会出现MySQL ERROR 1005: Can’t create table (errno: 150)的错误信息,结果是不能建立引用约束。 出现问题的大致情况 1、外键的引用类型不一样,如主键是int外键是char 2、找不到主表中引用的列 3、引用的字段和外键的字符编码不一致,也可能存储引擎不一样 4、引用的字段和外键的约束不同

 

 

我的错误是:相关联的表的名字t_customer与已建的表名不一致。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3