Home > database >  Foreign key constraints error 1064, your SQL syntax.
Foreign key constraints error 1064, your SQL syntax.

Time:10-19

The ALTER TABLE student ADD CONSISTENT FK_gradeID FOREIGN KEY (gradeID) REFERENCES grade (gradeID);
The ALTER TABLE student ADD CONSISTENT FK_studentNo FOREIGN KEY (studentNo) REFERENCES the result (studentNo);
The ALTER TABLE result ADD CONSISTENT FK_subjectNo FOREIGN KEY (subjectNo) REFERENCES SUBJECT (subjectNo);


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 'FK_gradeID foreign key references (gradeID) grade (gradeID)' at line 1

CodePudding user response:


The alter table student add constraint FK_gradeID foreign key student (gradeID) references grade (gradeID);

.
  • Related