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;
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;
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。