[英]MySQl Error #1064 42000
創建“訂單”表時,我總是收到錯誤消息。 有任何想法嗎? “客戶”表已經存在, cust#
列也已存在。 提前致謝。
create table orders(
`order#` char(4) not null,
orderdate date not null,
`cust#` char(4) not null,
amount decimal(10,2) not null,
primary key (`order#`),
foreign key (`cust#`) references customer (`cust#`)
on delete cascade on update cascade
) engine=InnoDB;
編輯:只是一個錯字。 感謝您的回復。
嘗試為外鍵添加CONSTRAINT
。
create table orders(
`order#` char(4) not null,
orderdate date not null,
`cust#` char(4) not null,
ord_amt decimal(10,2) not null,
primary key (`order#`),
CONSTRAINT `fk_cust` foreign key (`cust#`) references customer (`cust#`)
on delete cascade on update cascade
) engine=InnoDB;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.