其实还是那个老生常谈的问题,创建外键,可就是解决不了如下:CREATETABLEZhouyh_Students(zyh_SnoCHAR(8)NOTNULLUNIQUE,zyh_SnameCHAR(20)NOTNULL,zyh_SemailCHAR(50),zyh_Screditde...
其实还是那个老生常谈的问题,创建外键,可就是解决不了如下:
CREATE TABLE Zhouyh_Students
(zyh_Sno CHAR(8) NOT NULL UNIQUE,
zyh_Sname CHAR(20) NOT NULL,
zyh_Semail CHAR(50),
zyh_Scredit decimal(8,1),
CONSTRAINT PK_Zhouyh_Students PRIMARY KEY(zyh_Sno))engine=innodb;
CREATE TABLE Zhouyh_Teachers
(zyh_Tno CHAR(8) NOT NULL UNIQUE,
zyh_Tname CHAR(20) NOT NULL,
zyh_Temail CHAR(50),
zyh_Tsalary INT,
CONSTRAINT PK_Zhouyh_Teachers PRIMARY KEY(zyh_Tno))engine=innodb;
CREATE TABLE Zhouyh_Reports
(zyh_Sno CHAR(8) NOT NULL,
zyh_Tno CHAR(8) NOT NULL,
zyh_Score INT,
CONSTRAINT FK_Students_Sno FOREIGN KEY(zyh_Sno) REFERENCES Zhouyh_Students,
CONSTRAINT FK_Students_Cno FOREIGN KEY(zyh_Tno) REFERENCES Zhouyh_Teachers)engine=innodb;
出现的错误也就是Error code: 1005 can't create .....(errno:150)
展开