創建表失敗
執行下面的SQL語句創建表失敗,請問各位該如何解決?謝謝!!
CREATE table enrolls
(sno numeric(6,0) not null,
cno char(4) not null,
grade int
primary key (sno,cno)
foreign key (sno) references students(sno)
foreign key (cno) references courses(cno)
check((grade is null)or(grade between 0 and 100)))
錯誤提示:More than one column FOREIGN KEY constraint specified for column 'grade ', table 'enrolls '.
------解决方案--------------------CREATE table enrolls
(sno numeric(6,0) not null,
cno char(4) not null,
grade int ,
primary key (sno,cno),
foreign key (sno) references students(sno),
foreign key (cno) references courses(cno),
check((grade is null)or(grade between 0 and 100)))
------解决方案--------------------...豆号
------解决方案--------------------‘,’逗号,不加的话,就把后面的约束全当成是grade字段的了,自然就more than...了