Could anyone help me figure out what is wrong with my foreign key syntax? I have tried a few things and I can get everything working as intended until I add the ON DELETE clauses.
I have tried several different ways but whenever the on delete clauses are added I cannnot get the syntax correct. I have tried the documentation but I could not find a clear cut answer. the question
the code
CREATE TABLE LessonSchedule (
HorseID SMALLINT UNSIGNED NOT NULL,
StudentID SMALLINT UNSIGNED,
LessonDateTime DATETIME NOT NULL,
PRIMARY KEY (HorseID, LessonDateTime),
FOREIGN KEY (HorseID) REFERENCES Horse(ID),
ON DELETE CASCADE,
FOREIGN KEY (StudentID) REFERENCES Student(ID),
ON DELETE SET NULL
);
1