不能创建MySQL表
问题描述:
外键我得到这个错误不能创建MySQL表
#1005 - Can't create table 'chris_db.#sql-1464b_66' (errno: 150) (<a href="server_engines.php?engine=InnoDB&page=Status&token=7a7f690fbd1413e74979d79fa9044fb0">Details...</a>)
我Comp_Competition
表有CompetitionID
集作为主键。有人熟悉这个问题吗?
答
您的Comp_Entry表需要一个竞争ID的现有索引。另外,你的命令在表Comp__Competition的名称中有两个__
个字符,但在你的解释中只有一个。哪一个是对的?
答
因为在你的表格数据不脚的约束(例如不存在的键)
尽量使
select * from Comp_Entry where CompetitionID not in
(select distinct CompetitionID from Comp__Competition)