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;
2023-12-19 19:05:39
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;
下一篇:C# SQLite