create table student( Sno char(5) not null primary key,
Sname char(20) not null,
Ssex char(2) ,
Sage int ,
Sdept char(20)
)
create table SC (
Cno int not null, <<<====你这里类型都不一样呀!!是char吧!
Grade int not null,
Sno char(5) not null
/*CONSTRINT [FK_DEPTNO]
FOREIGN KEY(Sno)*/
REFERENCES student(Sno)
on delete CASCADE
on update cascade,
)
Sname char(20) not null,
Ssex char(2) ,
Sage int ,
Sdept char(20)
)
create table SC (
Cno int not null, <<<====你这里类型都不一样呀!!是char吧!
Grade int not null,
Sno char(5) not null
/*CONSTRINT [FK_DEPTNO]
FOREIGN KEY(Sno)*/
REFERENCES student(Sno)
on delete CASCADE
on update cascade,
)
goinsert into SC values('95001',1,92);
go
分两次提交.
Cno int not null,
Grade int not null,
Sno char(5) not null
/*CONSTRINT [FK_DEPTNO]
FOREIGN KEY(Sno)*/
REFERENCES student(Sno)
on delete CASCADE
on update cascade,
)最后有误
多了一个逗号
其次,Cno int not null的类型定义与插入的值不相符