56,800
社区成员




mysql>create table Course(
Cno char(4) primary key,
Cname CHAR(40),
Cpno char(4),
Ceredit snallint,
FOREIGN KEY Cpno REFERENCES Course(Cno)
);
create table SC(
Sno char(7),
index using btree (Sno),
Cno char(4),
index using btree (Cno),
Grade smallint,
primary key(Sno,Cno),
foreign key (Sno) references student(Sno),
foreign key (Cno) references Course(Cno))
engine=Innodb;
mysql> create table Course(
-> Cno char(4) primary key,
-> Cname char(40),
-> Cpno char(4),
/*表内创建索引*/
-> INDEX using BTREE (Cpno),
-> Ceredit smallint,
-> foreign key Cpno references Course(Cno))
-> ENGINE=InnoDB;
ERROR 1064 (42000): You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near 'references Course(Cno))
engine=InnoDB;