Failed to add the foreign key constraint. Missing index for constraint 'stu_ibfk_1' in the

alter table stu add foreign key(cno) references user(id);

Failed to add the foreign key constraint. Missing index for constraint 'stu_ibfk_1' in the referenced table 'user'

解决方案:

作为外键,user表中的id必须是唯一值,因此得添加约束unique,或者primary key;

上一篇:Sort 在 Linux


下一篇:C# SQLite