当前位置:Gxlcms > mysql > mysql-在MySQL中建表出现了错误,不会改。。。求帮忙,感谢

mysql-在MySQL中建表出现了错误,不会改。。。求帮忙,感谢

时间:2021-07-01 10:21:17 帮助过:4人阅读

mysql

错误是这样的:
ERROR 1005 (HY000): Can't create table 'db_database25.tb_selldetail' (errno: 150
)

建表的步骤和内容如下:

DROP TABLE IF EXISTS tb_selldetail;

CREATE TABLE tb_selldetail (
id int(11) NOT NULL auto_increment,

sellName varchar(200) NOT NULL,

sellPrice double NOT NULL,
sellCount int(11) NOT NULL,

sellTime datetime NOT NULL,
medid int(11) default NULL,

userid int(11) default NULL,
PRIMARY KEY (id),

KEY FK56C63894822F277 (userid),

KEY FK56C63894DD16E7A7(medid),
CONSTRAINT FK56C63894822F277 FOREIGN KEY (userid) REFERENCES tb_user (id),

CONSTRAINT FK56C63894DD16E7A7 FOREIGN KEY (medid) REFERENCES tb_medicine (id)
)
ENGINE=InnoDB DEFAULT CHARSET=gbk;

人气教程排行