【发布时间】:2014-12-16 00:50:39
【问题描述】:
表格
+---------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(64) | NO | | NULL | |
-----------------------------------------------------------------------
表2
ALTER TABLE Table2
ADD COLUMN person_id int(11),
ADD FOREIGN KEY fk_person_id(person_id) references Table(id);
这给了我一个错误,
错误 1005 (HY000): 无法创建表 'table2.#sql-3fb_7cf' (errno: 150)
表 1 id 的主键正确。还有哪里失败了?
【问题讨论】:
-
你的桌子真的被命名为'Table'吗?
标签: mysql