mysql-在MySQL中建表出现了错误,不会改。。。求帮忙,感谢
程序员文章站
2024-02-12 11:45:10
...
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;