📜  mysql 错误 1215 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:50.787000             🧑  作者: Mango

代码示例2
When you are trying to reference a key on parent table which is not a candidate key (either a primary key or a unique key) you may get the error code: 1215 cannot add foreign key constraint. ... It does not necessarily to be a primary key. MySQL requires index on corresponding referenced key, so you need a unique key