create table sc(
sno varchar2(8) not null references student(sno),
cno varchar2(8) not null references course(cno),
score varchar(8) not null
)
我感觉你是把constraint外键和直接外键的写法弄混了。
deptno NUMBER(2) 因为这一行的错误,应该是:deptno NUMBER(2) references dept 或者 deptno NUMBER(2) references dept(deptno)你仅写了foreign key,就不知道你想参考哪个表(主键)了
还有另外一种写法,你将foreign key去掉,在最后一行的右括号前
constraint fk_emp_deptno foreign key (deptno) references dept(或者dept(deptno),这个deptno可以省略,因为一个表只能有一个主键)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)