99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
2022-04-28 閱讀量: 1391
mysql報錯1822 :Failed to add the foreign key constraint. Missing index for constraint empo_ibfk_1

第一句代碼: create table dept(deptno int,dname varchar(15),loc varchar(10));

第二句代碼:

create table empo(empno int, ename varchar(15) unicode, job varchar(10) not null, mgr int, hiredate date, sal float default 4000, comn decimal,
deptno int, foreign key (deptno) references dept (deptno));

執(zhí)行第一句, 然后執(zhí)行第二句后報錯如下

7E}X7LG$R`Y9`X```6I%KW7.jpg

解決方法:

作為外鍵,dept表中的deptno必須是唯一值,因此得添加約束unique,或者primary key;


給第一句代碼加上unique,改為:

create table dept(deptno int unique ,dname varchar(15),loc varchar(10));

然后再執(zhí)行第二句就沒問題了


學(xué)習(xí)更多數(shù)據(jù)分析知識歡迎訪問 http://www.3lll3.cn/member.html?utm_source=weitao



510.7184
0
關(guān)注作者
收藏
評論(0)

發(fā)表評論

暫無數(shù)據(jù)
推薦帖子