我在哪里错了?继续收到错误"无法添加外键约束"

时间:2015-09-27 18:20:54

标签: sql

Create table Emp 
(
     eid integer, 
     name varchar(100),
     age integer, 
     salary real, 
     Primary Key(eid)
);

Create table Dept 
(
     did integer,
     budget Real,
     managerid integer, 
     Primary Key(did)
);

Create table Works 
(
    eid integer,
    did integer, 
    pct_time integer, 
    Foreign key (eid) References Emp
);

1 个答案:

答案 0 :(得分:1)

我想你忘了提到它所引用的专栏。

尝试:

...Foreign key (eid) References Emp (eid));