日期:2014-05-18 浏览次数:20709 次
--创建一个course1 create table course1 ( cno char(4) primary key, cname char(40), cpno char(4), ccredit smallint ); go --创建一个course2的外键为course1的cno create table course2 ( cno char(4) primary key , cname char(40) , cpno char(4) , ccredit smallint , foreign key ( cpno ) references course1 ( cno ) ) ;
------解决方案--------------------
Cpno少了小括号
create table Course
(
Cno char(4) primary key,
Cname char(40),
Cpno char(4),
Ccredit smallint,
foreign key (Cpno) references Course(Cno)
);